當前位置:首頁 » 文件管理 » 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
因為問題沒有出詳細,所以我的回答可能不會解決你的問題。

熱點內容
王者榮耀安卓一區是什麼 發布:2025-09-15 22:07:26 瀏覽:387
雲架構資料庫 發布:2025-09-15 22:01:01 瀏覽:334
廣州數控車床編程視頻 發布:2025-09-15 21:59:43 瀏覽:394
伺服器ip修改後oracle伺服器 發布:2025-09-15 21:58:08 瀏覽:401
禁止進程被訪問 發布:2025-09-15 21:55:00 瀏覽:255
編譯udf提示無stdioh 發布:2025-09-15 21:39:25 瀏覽:21
壓縮比數據 發布:2025-09-15 21:29:52 瀏覽:199
android刷ios 發布:2025-09-15 21:22:18 瀏覽:35
買伺服器如何砍價 發布:2025-09-15 21:04:27 瀏覽:821
我的世界直連伺服器的區別 發布:2025-09-15 20:59:12 瀏覽:63