當前位置:首頁 » 文件管理 » 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 發布:2025-07-12 21:56:53 瀏覽:913
JAVA擴展 發布:2025-07-12 21:51:08 瀏覽:150
忘記華為賬號密碼如何更改 發布:2025-07-12 21:43:20 瀏覽:777
字體android 發布:2025-07-12 21:30:38 瀏覽:621
資料庫中包含 發布:2025-07-12 21:25:08 瀏覽:621
艦娘緩存系統 發布:2025-07-12 21:21:21 瀏覽:100
cpu對存儲器的讀寫 發布:2025-07-12 21:21:14 瀏覽:772
如何建立一個網站需要伺服器 發布:2025-07-12 21:18:40 瀏覽:67
php登陸微信 發布:2025-07-12 21:17:55 瀏覽:14
公眾伺服器有什麼功能 發布:2025-07-12 21:11:22 瀏覽:715