How can a file be opened while it is being downloaded onto sdcard and not when downloading to /data/data/packagename?
Intent intent = new Intent("android.intent.action.VIEW");
intent.addCategory("android.intent.category.DEFAULT");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri uri = Uri.fromFile(new File(path));
intent.setDataAndType(uri, "image/*");
startActivity(intent);
the same code when the path is /mnt/sdcard/aaa.png the image can be show. while the path is data/data/com.test/aaa.png the image can't be show.Does it need some permission.I have download it in the path. the error is like
when parsing the image
09-12 11:54:31.448: ERROR/UriImage(545): got exception decoding bitmap
09-12 11:54:31.448: ERROR/UriImage(545): java.lang.NullPointerException
09-12 11:54:31.448: ERROR/UriImage(545): at com.android.camera.Util.makeInputStream(Util.java:336)
09-12 11:54:31.448: ERROR/UriImage(545): at com.android.camera.Util.makeBitmap(Util.java:307)
09-12 11:54:31.448: ERROR/UriImage(545): at com.android.camera.Util.makeBitmap(Util.java:299)
09-12 11:54:31.448: ERROR/UriImage(545): at com.android.camera.gallery.UriImage.fullSizeBitmap(UriImage.java:94)
09-12 11:54:31.448: ERROR/UriImage(545): at com.android.camera.gallery.UriImage.fullSizeBitmap(UriImage.java:86)
09-12 11:54:31.448: ERROR/UriImage(545): at com.android.camera.gallery.UriImage.thumbBitmap(UriImage.java:120)
09-12 11:54:31.448: ERROR/UriImage(545): at com.android.camera.ImageGetter$ImageGetterRunnable.executeRequest(ImageGetter.java:173)
09-12 11:54:31.448: ERROR/UriImage(545): at com.android.camera.ImageGetter$ImageGetterRunnable.run(ImageGetter.java:149)
09-12 11:54:31.448: ERROR/UriImage(545): at java.lang.Thread.run(Thread.java:1019)
09-12 11:54:31.828: ERROR/UriImage(545): got exception decoding bitmap
09-12 11:54:31.828: ERROR/UriImage(545): java.lang.NullPointerException
09-12 11:54:31.828: ERROR/UriImage(545): at com.android.camera.Util.makeInputStream(Util.java:336)
09-12 11:开发者_C百科54:31.828: ERROR/UriImage(545): at com.android.camera.Util.makeBitmap(Util.java:307)
09-12 11:54:31.828: ERROR/UriImage(545): at com.android.camera.Util.makeBitmap(Util.java:299)
09-12 11:54:31.828: ERROR/UriImage(545): at com.android.camera.gallery.UriImage.fullSizeBitmap(UriImage.java:94)
09-12 11:54:31.828: ERROR/UriImage(545): at com.android.camera.ImageGetter$ImageGetterRunnable.executeRequest(ImageGetter.java:204)
09-12 11:54:31.828: ERROR/UriImage(545): at com.android.camera.ImageGetter$ImageGetterRunnable.run(ImageGetter.java:149)
09-12 11:54:31.828: ERROR/UriImage(545): at java.lang.Thread.run(Thread.java:1019)
when parsing the apk file
09-12 12:01:41.307: WARN/PackageParser(1298): Skipping dir: /data/data/com.download.activity/files/aaa.apk
09-12 12:01:41.307: WARN/PackageInstaller(1298): Parse error when parsing manifest. Discontinuing installation.
Have you set a permission to access the SD card?
精彩评论