Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6469051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:56:52+00:00 2026-05-25T05:56:52+00:00

If I have this in hand: R.drawable.foo Which is really just a reference to

  • 0

If I have this in hand:

R.drawable.foo

Which is really just a reference to a jpg file, how do I open it in Android’s gallery app?

I have found a bunch of references which suggest something along the lines of this:

startActivity(
    new Intent(
        Intent.ACTION_VIEW,  
        /* what goes here for the URI?? */
    )
); 

But what URI do I use?

I’m doing this tutorial and want to open the images in the native Android app when tapped so I can get all that zooming, sharing, etc. for free.

If I can’t use a URI here (as suggested here), what should I do to load the image?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T05:56:52+00:00Added an answer on May 25, 2026 at 5:56 am

    by design other applications cannot access your resources. its the same the otherway.

    so you have two options.

    Easyway:

    copy your resource (manualy) to the sdcard and then sent the uri

    this is how your URI might look

    Uri.parse(Environment.getExternalStorageDirectory() + "/android/com.my.app/.cache/foo.jpg");
    

    Environment.getExternalStorageDirectory() abstracts hard coding or mount
    the .cache will be a hidden folder and if you don’t want your temp image to show up in gallery images then you need to create a .nomedia empty file in the .cache folder

    you might need to add the sdcard permission

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    

    the Hardway:

    your need to implement a FileContentProvider using a ContentProvider

    supply you custom URI and supply your file from your FileContentProvider.Open, you may need to implement mime and other methods aswell for this

    UPDATE
    you may also need to register your content provider in the manifest.
    Android – open pdf in external application

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been doing this by hand and I just can't do it anymore--
The issue at hand is this. We have a web application with two different
I have normally hand written xml like this: <tag><?= $value ?></tag> Having found tools
I am new this sharepoint development and i have task in hand to do
I have this line in a javascript block in a page: res = foo('<%=
I have got this read file code from microsoft @C:\Users\computing\Documents\mikec\assignment2\task_2.txt That works fine when
I have this line of Javascript which runs a function I sourced online. However
I have this question you probably know the answer... My app is already functional
hello everyone I have this snippet of the code: void* Init(int N) { Hand
I'm trying my new hand at Code Igniter and have this issue come up.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.