當前位置:首頁 » 文件管理 » asset文件夾

asset文件夾

發布時間: 2024-12-21 13:01:47

『壹』 如何打開assets文件夾中的apk

在自己的app中安裝assets目錄下的apk文件的方法:

詳細過程如下:

{

ContextmContext;

@Override

protectedvoidonCreate(BundlesavedInstanceState){

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

mContext=this;

//Toast.makeText(this,""+Environment.getExternalStorageDirectory().getAbsolutePath(),0).show();

if(ApkFromAssets(this,"test.apk",Environment.getExternalStorageDirectory().getAbsolutePath()+"/test.apk")){

Builderm=newAlertDialog.Builder(mContext)

.setIcon(R.drawable.ic_launcher).setMessage("是否安裝?")

.setIcon(R.drawable.ic_launcher)

.setPositiveButton("yes",newOnClickListener(){

@Override

publicvoidonClick(DialogInterfacedialog,intwhich){

Intentintent=newIntent(Intent.ACTION_VIEW);

intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

intent.setDataAndType(Uri.parse("file://"+Environment.getExternalStorageDirectory().getAbsolutePath()+"/test.apk"),

"application/vnd.android.package-archive");

mContext.startActivity(intent);

}

});

m.show();

}

}

publicbooleanApkFromAssets(Contextcontext,StringfileName,Stringpath){

booleanIsFinish=false;

try{

InputStreamis=context.getAssets().open(fileName);

Filefile=newFile(path);

file.createNewFile();

FileOutputStreamfos=newFileOutputStream(file);

byte[]temp=newbyte[1024];

inti=0;

while((i=is.read(temp))>0){

fos.write(temp,0,i);

}

fos.close();

is.close();

IsFinish=true;

}catch(IOExceptione){

e.printStackTrace();

}

returnIsFinish;

}

}

『貳』 為什麼我的世界1.7.2assets沒有minecraft文件夾

asset文件夾在1.7時代就已經被被替換成了材質+聲音的原版資源包文件夾了。
請在
version文件夾→版本
里尋找jar
因為問題沒有出詳細,所以我的回答可能不會解決你的問題。

熱點內容
伺服器如何添加聯想de存儲 發布:2025-10-16 09:30:39 瀏覽:925
站群伺服器ip怎麼解析 發布:2025-10-16 09:25:06 瀏覽:471
編程打古詩 發布:2025-10-16 09:17:51 瀏覽:641
python正態隨機數 發布:2025-10-16 09:13:27 瀏覽:210
新建域用戶如何保存原來的配置 發布:2025-10-16 09:05:01 瀏覽:966
安卓相機怎麼調出蘋果相機的效果 發布:2025-10-16 08:56:21 瀏覽:692
我的世界大伺服器列表 發布:2025-10-16 08:50:09 瀏覽:444
如何找回發票軟體用戶名密碼 發布:2025-10-16 08:35:54 瀏覽:305
電腦怎麼打開伺服器界面 發布:2025-10-16 08:13:40 瀏覽:408
115安卓同時下載的文件在哪裡 發布:2025-10-16 08:05:34 瀏覽:413