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 7725079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:50:57+00:00 2026-06-01T04:50:57+00:00

I have an application that allow users to choose picture from native gallery then

  • 0

I have an application that allow users to choose picture from native gallery then I show this image in image view widget.

My question is:
1-i have to send this image to another Activity. How can i do it.

2-in the receiver Activity i should show it in image view widget as in image not link or Something

I tried this code but it gives me a RunTime Error

   Bitmap image = Bitmap.createBitmap(view.getWidth(), view.getHeight(),Bitmap.Config.RGB_565);
   view.draw(new Canvas(image));
   String url = Images.Media.insertImage(getContentResolver(), image,"title", null);
  • 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-06-01T04:50:58+00:00Added an answer on June 1, 2026 at 4:50 am

    Just follow the below steps…

    Uri uri = null;
    1) on any click event use the below code to open native gallery

    Intent intent = new Intent();
    intent.setType("image/*");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    startActivityForResult(Intent.createChooser(intent, "Select Picture"),0);
    

    This will open gallery select picture will return you to your activity. OnActivity result.

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode) {
    case 0:
        if (resultCode == RESULT_OK) {
        try {
        uri = Uri.parse(data.getDataString());
        imageView.setImageUri(uri);
    } catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IOException e) {
    // TODO Auto-generated catch block
        e.printStackTrace();
        }}
        break;
        }
    }
    

    2) Also instead of passing the image you can pass the URI to next activity as you pass string and inthe secont activity you get it using intent.

    Intent i = new Intent(this, Second.class);
    i.putExtra("URI", uri.toString() );
    startActivity(i);
    

    and in the second activity

    String uri = getIntent().getStringExtra("URI");
    

    Now you have string just set it to the image view like below

    imageView.setImageUri(Uri.parse(uri));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that allows users to write their own code in a
Let say, I have a web application that allows users to upload images and
We have created a web application, using ASP.NET, that allows users to upload documents
I have an application that allows the user to download a csv. This works
I have a application that allows a user to choose some parameters for a
So I have an rails admin system that will allow a user to choose
I have a report that I currently allow the user to choose an output
I'm looking for techniques that allow users to override modules in an application or
I have an app that behaves somewhat like a photo gallery. They choose an
I have a web application that allows a user to search on some criteria,

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.