推 aquatear:謝謝您 ~ 您太厲害了 ~~ 07/11 01:27
: → MiaShopgirl:onCreate的時候確認SD路徑下沒有要用的檔案的時候, 07/06 13:19
: → MiaShopgirl:把檔案放在assets裡面,再copy到SD 吧..? 07/06 13:20
: → MiaShopgirl:or直接存取assets,就不用再複製到SD 07/06 17:27
: → aquatear:恩, 目前是用拷貝的方式進 sdcard, 不過這樣會有更新的問 07/07 21:46
: → aquatear:題, 變成每次啟動都會 copy 一次,因為程式只能讀取檔案 07/07 21:47
如果要避開「每次啟動都會 copy 一次」,
可以檢查檔案是否存在再決定要不要複製檔案..
File file=
new File(Environment.getExternalStorageDirectory(), "yourFileName.here");
if(!file.exists()){
/**copy file method**/
//copying file to externalStorage..
}else{
/**file existed, no need to copy file**/
}
: → aquatear:路徑, assets 似乎沒辦法提供真正的檔案路徑來存取,還是 07/07 21:47
: → aquatear:有辦法 ? 07/07 21:47
把檔案放在assets下存取,
InputStream is = getAssets().open("yourFileName.here");
專案目錄結構:
YourProjectName\
assets\yourFileName.here
bin\
gen\
libs\
res\
src\
AndroidManifest.xml
--
是說以上的討論跟標題的「外部檔案安裝」不太一樣..
標題會讓我想成apk附加的擴充檔..
RF:http://lp43.blogspot.tw/2012/03/android-app50mb.html
Title:[技術公報]Android App打破50MB的上傳限制了
※ 編輯: MiaShopgirl 來自: 114.32.163.6 (07/09 12:53)
恕刪..