2013-06-20 31 views
0

我的代碼下載apk到在模擬器和安卓設備上使用SD卡的SD卡工作正常。我正在開發應用程序的Android棒棒有Nand Flash /內部Flash不SD卡。如何獲得Nand Flash「下載」forlder的路徑。如何在NandFlash中找到下載文件夾的路徑?如何下載apk文件到nand閃存沒有SD卡的內存?

Intent intent = new Intent(Intent.ACTION_VIEW); 
     intent.setDataAndType(Uri.fromFile(new File("/internalmemory/Download/newversion.apk")), "application/vnd.android.package-archive"); 
     intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // without /mnt/sdcard this flag android returned a intent error! 
     context.startActivity(intent); 

回答

0

我如何才能找到下載文件夾中的NandFlash的路徑?

你希望找到的「下載文件夾的路徑」在其他地方用同樣的方法:你可以在the documentation閱讀更多關於getExternalStoragePublicDirectory()

Environment.getExternalStoragePublicStorageDirectory(Environment.DIRECTORY_DOWNLOADS)` 

。您也可以考慮閱讀關於external storage的更一般文檔。

+0

我試過這給了我「/ mnt/sdcard」。 NandFlash是內部存儲器,不是外部的。有什麼想法嗎? –

+0

@RickyWatson:'/ mnt/sdcard'就是所謂的「目錄」。它包含「文件」。這個「目錄」所在的位置取決於設備的實現。對於數億個Android設備,'/ mnt/sdcard'將指向板載閃存。如果您花時間閱讀我鏈接的文檔,那麼您已經瞭解了這一點。請閱讀:http://developer.android.com/guide/topics/data/data-storage.html#filesExternal – CommonsWare

+0

修復....非常感謝@CommonsWare –