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

熱點內容
打包sql資料庫 發布:2025-07-12 16:19:27 瀏覽:794
php日誌查看 發布:2025-07-12 16:12:10 瀏覽:212
ftp目錄映射為本地盤符 發布:2025-07-12 16:06:59 瀏覽:643
nas存儲百科 發布:2025-07-12 16:03:17 瀏覽:124
python的sort函數 發布:2025-07-12 15:53:21 瀏覽:48
ensp伺服器怎麼設置web根目錄 發布:2025-07-12 15:47:56 瀏覽:284
安卓怎麼設置二卡發信息 發布:2025-07-12 15:43:50 瀏覽:743
如何看到無線密碼 發布:2025-07-12 15:43:13 瀏覽:675
好網址可緩存 發布:2025-07-12 15:36:07 瀏覽:252
centos安裝php52 發布:2025-07-12 15:14:19 瀏覽:298