I assume that you can open images from your resources folder with Intent.ACTION_VIEW?
If not then let me know, and don’t bother reading on! haha
If you can then I have this code:
Intent mainIntent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.parse("android.resource://com.tclayson.myapp/"+extrasImgs.mImagesIds[position]);
mainIntent.setDataAndType(uri, "image/jpg");
startActivity(mainIntent);
And yet it is giving me this error:
E/AndroidRuntime( 309): FATAL EXCEPTION: main
E/AndroidRuntime( 309): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=android.resource://com.tclayson.myapp/2130837611 }
E/AndroidRuntime( 309): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1512)
E/AndroidRuntime( 309): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
E/AndroidRuntime( 309): at android.app.Activity.startActivityForResult(Activity.java:3190)
E/AndroidRuntime( 309): at android.app.Activity.startActivity(Activity.java:3297)
E/AndroidRuntime( 309): at com.tclayson.myapp.FBRadioPlayer$SlidingContentPagerAdapter$5.onItemClick(TheActivity.java:226)
E/AndroidRuntime( 309): at android.widget.AdapterView.performItemClick(AdapterView.java:292)
E/AndroidRuntime( 309): at android.widget.AbsListView.performItemClick(AbsListView.java:1058)
E/AndroidRuntime( 309): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2514)
E/AndroidRuntime( 309): at android.widget.AbsListView$1.run(AbsListView.java:3168)
E/AndroidRuntime( 309): at android.os.Handler.handleCallback(Handler.java:605)
E/AndroidRuntime( 309): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 309): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 309): at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime( 309): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 309): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 309): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime( 309): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime( 309): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 152): Force finishing activity com.tclayson.myapp/.MyActivity
I have no idea what could be wrong with this! Any help would be brilliant.
Thanks
I couldn’t find the answer to this. So I created my own image viewer in the app.