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

  • Home
  • SEARCH
  • 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 7008563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:45:06+00:00 2026-05-27T21:45:06+00:00

So far I have my app taking a picture AndroidCamera.java using the camera and

  • 0

So far I have my app taking a picture AndroidCamera.java using the camera and then saving the image and displaying it in a new Activity Punch.java which works fine. On this screen there are then two options too use the image or retake the image if the button retake is clicked it will go back to the AndroidCamera.java Activity and if use is clicked it will then go to the Activity BeatEmUp.java which is the new Activity I want to show the image on again.

I just cant figure out what to put in the BeatEmUp.java Activity to display the image again in this new Activity you can see on the code below that I am passing the string from AndroidCamera.java to Punch.java but don’t think I can do this again from the Punch.java to BeatEmUp.java?

Update Adil Soomro

BeatEmUp.java Activity now force closes when Use button is clicked.

Ok code below has been updated I had to change intent.putExtra("filepath",imagePath);
to Use.putExtra("filepath",imagePath); as with intent at the start it was giving me an error I have also added the BeatEmUp.java as I am not sure if this is correct i thought it would just be the same code as I use to show the image on Punch.java

AndroidCamera.java

PictureCallback myPictureCallback_JPG = new PictureCallback(){

    public void onPictureTaken(byte[] arg0, Camera arg1) {
        // TODO Auto-generated method stub
        /*Bitmap bitmapPicture 
            = BitmapFactory.decodeByteArray(arg0, 0, arg0.length);  */
        int imageNum = 0;
        Intent imageIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
        File imagesFolder = new File(Environment.getExternalStorageDirectory(), "Punch");
        imagesFolder.mkdirs(); // <----
        String fileName = "image_" + String.valueOf(imageNum) + ".jpg";
        File output = new File(imagesFolder, fileName);
        while (output.exists()){
            imageNum++;
            fileName = "image_" + String.valueOf(imageNum) + ".jpg";
            output = new File(imagesFolder, fileName);
        }

        Uri uriSavedImage = Uri.fromFile(output);
        imageIntent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);


        OutputStream imageFileOS;
        try {
            imageFileOS = getContentResolver().openOutputStream(uriSavedImage);
            imageFileOS.write(arg0);
            imageFileOS.flush();
            imageFileOS.close();

            Toast.makeText(AndroidCamera.this, 
                    "Image saved", 
                    Toast.LENGTH_LONG).show();

        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        Intent intent = new Intent(getBaseContext(), Punch.class);
        intent.putExtra("filepath",Uri.parse(output.getAbsolutePath()).toString());
        //just using a request code of zero
        int request=0;
        startActivityForResult(intent,request); 
    }};

Punch.java

String imagePath;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.punch);

    imagePath = this.getIntent().getStringExtra("filepath");

    Button buse = (Button) findViewById(R.id.buse);
    buse.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            Intent Use = new Intent(Punch.this, BeatEmUp.class);
            Use.putExtra("filepath",imagePath);
            startActivity(Use);                 
        }
    });

    Button bretake = (Button) findViewById(R.id.bretake);
    bretake.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            Intent Retake = new Intent(Punch.this, AndroidCamera.class);
            startActivity(Retake);              
        }
    });

    String myRef = this.getIntent().getStringExtra("filepath");
    File imgFile = new  File(myRef);

    Log.e(">>>", myRef);
    if(imgFile.exists()){

        Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
        ImageView myImage = (ImageView) findViewById(R.id.imagepunch);
        myImage.setImageBitmap(myBitmap);

    }
}

}

BeatEmUp.java

String myRef = this.getIntent().getStringExtra("filepath");
    File imgFile = new  File(myRef);

    Log.e(">>>", myRef);
    if(imgFile.exists()){

        Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
        ImageView myImage = (ImageView) findViewById(R.id.imagepunch);
        myImage.setImageBitmap(myBitmap);
  • 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-27T21:45:07+00:00Added an answer on May 27, 2026 at 9:45 pm

    Yes. You can pass that image URI again to next Activity.

    You just need to store image path in class level variable in Punch.java class, and when starting BeatEmUp Activity, put that Image path again in the Intent and get it in BeatEmUp

    Edit:

    Take a class level String in Punch.java

    String imagePath;
    

    and inside onCreate()

    imagePath = this.getIntent().getStringExtra("filepath");
    

    and when starting BeatEmUp Activity

    Intent Use = new Intent(Punch.this, BeatEmUp.class);
    intent.putExtra("filepath",imagePath);
    startActivity(Use); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So far I have my app taking a picture creating a new folder on
I have a great app for capturing shoutcast streams :-) . So far, it
So far I have learned about generating thread dump and heap dump using jstack
I am pretty new to this iPhone dev thing but so far I have
package info.testing; import java.io.IOException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.select.Elements; import android.app.Activity; import android.os.Bundle;
I have an app using a UITabBarController, and I have another view that needs
So far I have encountered adjacency list, nested sets and nested intervals as models
So far i have got the code below which works lovely when trying an
So far I have been creating Web Portal but recently I had a request
So far I have managed to write some code that should print the source

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.