如何使用Android默认库显示错误打开特定文件夹图像

时间:2013-05-05 07:48:22

标签: android android-gallery

我使用以下代码打开特定目录中的图像..问题是它对我的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)

1 个答案:

答案 0 :(得分:0)

这是因为您的设备没有能够查看该本地文件的应用程序。尝试从appStore下载与查看图像相关的应用程序。

我正在通过参考您提供的logcat详细信息来回答这个问题。(可能是也可能不是正确答案)

希望这有帮助