我試圖讓視頻彈出並播放。當我使用第一個URI(在下面的代碼中註釋掉)時,我可以得到它的工作,但是當我嘗試使用第二個URI(來自資源)時,出現以下錯誤:如何從資源播放視頻文件?
ERROR/AndroidRuntime(1052): android.content.ActivityNotFoundException: No Activity found to handle Intent { dat=android.resource://com.slamdunksoftware.presentation/2130968576 typ=video/* }
從研究錯誤,看起來我可能需要在清單中聲明一個活動,但我不確定這是否適用於此處。有人能指引我朝着正確的方向嗎?
Intent in = new Intent(Intent.ACTION_VIEW);
//Uri uri = Uri.parse(Environment.getExternalStorageDirectory().toString() + "/page4a.m4v");
Uri uri = Uri.parse("android.resource://com.slamdunksoftware.presentation/" + R.raw.page4a);
in.setDataAndType(uri, "video/*");
startActivity(in);
您可能要改寫這是「我怎樣才能從資源播放視頻文件?」 ActivityNotFound異常在這裏是一個紅鯡魚的位。 – 2010-11-23 20:22:39