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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:56:21+00:00 2026-05-28T01:56:21+00:00

I have a ImageView which shows a picture that has been taken from the

  • 0

I have a ImageView which shows a picture that has been taken from the camera. The effect i am trying to create is I want a image to appear over the ImageView with the OnTouchEvent. So say I have five images I am wanting it to have five OnTouchEvent’s and for each touch on the screen a new image would appear over the top of the previouslly displayed image (they are transparent png’s).

I have looked through this question Adding an Image to a Canvas in Android but can’t get my head around it.

So basically I am wanting it so when you are viewing the Activity with the Image in the ImageView you can touch the screen which will then add a png over the top of the picture in the ImageView and so on for say 6 or 7 images. Each one gets added sepertaly so it would take 6 touchs of the screen to add 6 png’s over the current Image in the Imageview

UPDATE Thanks to Graeme

The code below has been updated I am just getting an error on nextBitmap which is nextBitmap cannot be resolved I think this is because I need to set this somewhere to go through the images that will be added like make an array?

Update 2

I now know that I need to some how add a string nextBitmap with the Images in so that it will loop throw them when the screen is touched, anyone got any ideas?

public class BeatEmUp extends Activity {

Bitmap myBitmap;    

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.beatemup);

    String myRef = this.getIntent().getStringExtra("filepath");
    File imgFile = new  File(myRef);
    Log.e("No ref", myRef);

    if(imgFile.exists()) {
        final Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
        final ImageView myImage = (ImageView) findViewById(R.id.beatemup);
        myImage.setImageBitmap(myBitmap);
        myImage.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                myBitmap = getBitmapOverlay(myBitmap, nextBitmap, 0, 0);
                myImage.setImageBitmap(myBitmap);
            }
        });
    }
}

public static Bitmap getBitmapOverlay(Bitmap bmp1, Bitmap bmp2, int left, int top) {
    Bitmap bmOverlay = Bitmap.createBitmap(bmp1.getWidth(), bmp1.getHeight(),  bmp1.getConfig());
    Canvas canvas = new Canvas(bmOverlay);    
    canvas.drawBitmap(bmp1, 0, 0, null);
    canvas.drawBitmap(bmp2, left, top, null);
    return bmOverlay;
}
}
  • 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-28T01:56:21+00:00Added an answer on May 28, 2026 at 1:56 am

    Following from @Gabi’s answer:

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.beatemup);
    
        String myRef = this.getIntent().getStringExtra("filepath");
        File imgFile = new  File(myRef);
        Log.e("No ref", myRef);
    
        if(imgFile.exists()) {
            Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
            ImageView myImage = (ImageView) findViewById(R.id.beatemup);
            myImage.setImageBitmap(myBitmap);
            myImage.setOnClickListener(new OnClickListener() {
    
                @Override
                public void onClick(View v) {
                    myBitmap = getBitmapOverlay(myBitmap, nextBitmap, 0, 0));
                    myImage.setImageBitmap(myBitmap);
                }
            });
        }
    }
    
    public static Bitmap getBitmapOverlay(Bitmap bmp1, Bitmap bmp2, int left, int top) {
        Bitmap bmOverlay = Bitmap.createBitmap(bmp1.getWidth(), bmp1.getHeight(),  bmp1.getConfig());
        Canvas canvas = new Canvas(bmOverlay);    
        canvas.drawBitmap(bmp1, 0, 0, null);
        canvas.drawBitmap(bmp2, left, top, null);
        return bmOverlay;
    }
    

    You’ll need to initialise nextBitmap yourself (and have it change after you have clicked the image).

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

Sidebar

Related Questions

In Java I have created the following class which extends ImageView to create a
I have a Custom ListView which has an ImageView and a TextView. and i
I have a class named CropImageView which is extended from ImageView . but the
I have an activity which shows 3 random images from JSON data off the
I have a CALayer that's a sublayer of an ImageView. This shows an image,
i have an app widget, which contains only one imageview. i redraw that image
I want to use private drawable from android. for that i have downloade androi-8.jar
I have a custom class inheriting from UITableViewCell class that shows either an image
I am trying to create an App that takes a picture when a button
I have an onClickListener that should call a class that shows and image from

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.