android - Can I use ACTION_VIEW to view a JPG I've downloaded? -
i'm having terrible time trying view jpg file i've downloaded using action_view in android app. can verify file present , correct size. can pull file emulator , open on computer, know jpg not corrupt. i've tried code in view image in action_view intent?.
my code follows:
// start intent view file string filename = "test.jpg" string downloadsdirectorypath = getfilesdir().getpath() + "/downloads"; file file = new file(downloadsdirectorypath + "/" + filename); intent = new intent(); i.setaction(intent.action_view); i.setdataandtype(uri.fromfile(file), "image/*"); startactivity(i);
this seems should straight forward, whenever run above code,
error/uriimage(336): got exception decoding bitmap error/uriimage(336): java.lang.nullpointerexception error/uriimage(336): @ com.android.camera.util.makeinputstream(util.java:336) error/uriimage(336): @ com.android.camera.util.makebitmap(util.java:307) error/uriimage(336): @ com.android.camera.util.makebitmap(util.java:299) error/uriimage(336): @ com.android.camera.gallery.uriimage.fullsizebitmap(uriimage.java:94) error/uriimage(336): @ com.android.camera.gallery.uriimage.fullsizebitmap(uriimage.java:86) error/uriimage(336): @ com.android.camera.gallery.uriimage.thumbbitmap(uriimage.java:120) error/uriimage(336): @ com.android.camera.imagegetter$imagegetterrunnable.executerequest(imagegetter.java:173) error/uriimage(336): @ com.android.camera.imagegetter$imagegetterrunnable.run(imagegetter.java:149) error/uriimage(336): @ java.lang.thread.run(thread.java:1096)
any ideas what's going on here?
as far can make out looking @ platform source code, passing in non-existent file path in uri.
what value of downloadsdirectorypath? bet 15 rep points it's not fully-qualified...
Comments
Post a Comment