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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:43:37+00:00 2026-05-23T20:43:37+00:00

Hi stackoverflow friends, I need to take a picture using camera and after takin

  • 0

Hi stackoverflow friends,
I need to take a picture using camera and after takin the picture go to next activity without showing the first activity. And display it in an imageview.
Below is the flow of my application

first activity-> there is button for camera intent->go to the next activity(without showing the fist activity) second activity->there i need to show the image in imageview.

I saw a lot of examples of camera intent nobody explains how to go to the next activity without showing the first and display it in imageview of second.

Any outofmemeory problem occurs while displaying images in imageview repeatedly?

Thanks in advance

  • 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-23T20:43:37+00:00Added an answer on May 23, 2026 at 8:43 pm

    In First activity :

     Button b=(Button)findViewByid(R.id.button);
     b.setOnClickListener(new OnClickListener() {
    
        @Override
        public void onClick(View v) {
        doTakePhotoAction();
    
        }
    }); 
        private void doTakePhotoAction() {
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    mUri = Uri.fromFile(new File(Environment.getExternalStorageDirectory(),
        "pic_" + String.valueOf(System.currentTimeMillis()) + ".jpg"));
    intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, mUri);
    
    try {
        intent.putExtra("return-data", true);
        startActivityForResult(intent, CAMERA_RESULT);
           // finish();
    } catch (ActivityNotFoundException e) {
        e.printStackTrace();
    }
    }
    
     protected void onActivityResult(int requestCode, 
        int resultCode, Intent data) {
    if (resultCode != RESULT_OK) {
        return;
    }
    if (requestCode == CAMERA_RESULT) {
        Intent intent = new Intent(this, nextimage.class);
        // here you have to pass absolute path to your file
        intent.putExtra("image-path", mUri.getPath());
        intent.putExtra("scale", true);
        startActivity(intent);
            finish();
    }
    }
    

    In nextimage.class you can set one image view and get the imagepath from putExtra and place it in imageview.

      String mImagePath = extras.getString("image-path");
      Bitmap mBitmap = getBitmap(mImagePath);
       private Uri getImageUri(String path) {
    return Uri.fromFile(new File(path));
    }
    
    private Bitmap getBitmap(String path) {
    Uri uri = getImageUri(path);
    InputStream in = null;
    try {
        in = mContentResolver.openInputStream(uri);
        return BitmapFactory.decodeStream(in);
    } catch (FileNotFoundException e) {
        Log.e(TAG, "file " + path + " not found");
    }
    return null;
    }
    

    place the bitmap in the imageview.you have to create imageview in secondActivity.

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

Sidebar

Related Questions

After stackoverflow answered my previous question on here about my Wiimote left/right click issue,
Stackoverflow displays your reputation next to your username. I suppose it doesn't hit the
Stackoverflow is built on MVC and does a bunch of simple but nice things
StackOverflow user jolson had a very nice piece of code that exemplifies how one
Stackoverflow User Luke wrote in this answer : The boundaries between desktop and web
StackOverflow, you're my only hope! I am unfortunate enough to have inherited an ASP.NET
In StackOverflow podcast no. 19 , Joe describe Fogcreek's decision to have one database
Hey stackoverflow community! I'm having an issue where a highly involved algorithmic program is
I notice that StackOverflow has a views count for each question and that these
What do wikis/stackoverflow/etc. do when it comes to storing text? Is the text broken

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.