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

熱點內容
java返回this 發布:2025-10-20 08:28:16 瀏覽:645
製作腳本網站 發布:2025-10-20 08:17:34 瀏覽:936
python中的init方法 發布:2025-10-20 08:17:33 瀏覽:632
圖案密碼什麼意思 發布:2025-10-20 08:16:56 瀏覽:821
怎麼清理微信視頻緩存 發布:2025-10-20 08:12:37 瀏覽:731
c語言編譯器怎麼看執行過程 發布:2025-10-20 08:00:32 瀏覽:1066
郵箱如何填寫發信伺服器 發布:2025-10-20 07:45:27 瀏覽:299
shell腳本入門案例 發布:2025-10-20 07:44:45 瀏覽:160
怎麼上傳照片瀏覽上傳 發布:2025-10-20 07:44:03 瀏覽:852
python股票數據獲取 發布:2025-10-20 07:39:44 瀏覽:763