次のコードを使用して、特定のディレクトリから画像を開きます..問題は、Galaxy ace で正常に動作することです...しかし、他の電話で開くことができません..スタックトレースも添付しました. 助けてください..ありがとう:)
private void startScan() {
Log.d(Login.TAG, "Scan Started");
if (conn != null) {
conn.disconnect();
}
conn = new MediaScannerConnection(this, this);
conn.connect();
}
public void onMediaScannerConnected() {
conn.scanFile(SCAN_PATH, FILE_TYPE);
}
public void onScanCompleted(String path, Uri uri) {
try {
if (uri != null) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(uri);
startActivity(intent);
}
} finally {
conn.disconnect();
conn = null;
}
}
0
5-05 13:11:46.990: E/JavaBinder(3437): *** Uncaught remote exception! (Exceptions are not yet supported across processes.)
05-05 13:11:46.990: E/JavaBinder(3437): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://media/external/images/media/8899 }
05-05 13:11:46.990: E/JavaBinder(3437): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1580)
05-05 13:11:46.990: E/JavaBinder(3437): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1431)
05-05 13:11:46.990: E/JavaBinder(3437): at android.app.Activity.startActivityForResult(Activity.java:3446)
05-05 13:11:46.990: E/JavaBinder(3437): at android.app.Activity.startActivityForResult(Activity.java:3407)
05-05 13:11:46.990: E/JavaBinder(3437): at android.app.Activity.startActivity(Activity.java:3617)
05-05 13:11:46.990: E/JavaBinder(3437): at android.app.Activity.startActivity(Activity.java:3585)
05-05 13:11:46.990: E/JavaBinder(3437): at com.youbank.NewMenu.onScanCompleted(NewMenu.java:127)
05-05 13:11:46.990: E/JavaBinder(3437): at android.media.MediaScannerConnection$1.scanCompleted(MediaScannerConnection.java:56)
05-05 13:11:46.990: E/JavaBinder(3437): at android.media.IMediaScannerListener$Stub.onTransact(IMediaScannerListener.java:60)
05-05 13:11:46.990: E/JavaBinder(3437): at android.os.Binder.execTransact(Binder.java:367)
05-05 13:11:46.990: E/JavaBinder(3437): at dalvik.system.NativeStart.run(Native Method)