2011-05-11 76 views

回答

0

IIRC,openRawResource()需要一個資源ID。它不適用於文件路徑。

嘗試

is = new BufferedInputStream(new FileInputStream(location)); 

更換

is = context.getResources().openRawResource(location); 

記住,你需要SD卡的權限。

+0

謝謝,但沒有它沒有工作... – arayray 2011-05-11 01:33:11

+0

你能告訴我們你得到什麼錯誤消息? – musaul 2011-05-11 01:49:58

+0

抱歉它確實有效,但是當我設置視圖時,它只是顯示一個黑屏 – arayray 2011-05-11 04:15:03

0

試試這個

String file = Environment.getExternalStorageDirectory() 
       .toString(); 
mFileName = Environment.getExternalStorageDirectory().getAbsolutePath(); 
     mFileName += "/yourfilename.raw"; 

這將讓在該字符串文件的文件。然後你繼續你的代碼....