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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:38:26+00:00 2026-06-05T22:38:26+00:00

In my xml file, I have declared two imageview and later I add image

  • 0

In my xml file, I have declared two imageview and later I add image in it by using setImageBitmap() method and also apply separate touch event.

But here problem is that I can’t move first image when second image is added into setImageBitmap() and only second image is moveable now.

Thanks in advance and sorry for english.

working_bitmap = BitmapFactory.decodeFile(file_location+"cropped_image.jpg");  
outBitmap=Bitmap.createBitmap(
working_bitmap.getWidth(),
working_bitmap.getHeight(),Bitmap.Config.ARGB_8888);    
Canvas canvas1 = new Canvas(outBitmap);
canvas1.drawBitmap(working_bitmap, new Matrix(), null);
if(downloaded_shirt_image != null)
{
    int width = downloaded_shirt_image.getWidth();
    int height = downloaded_shirt_image.getHeight();
    int halfWidth = width/3;
    int halfHeight = height/3;
    //Half Scaled
    Bitmap bmHalf = Bitmap.createScaledBitmap(downloaded_shirt_image,
        halfWidth, halfHeight, false);
    proimg =(ImageView)findViewById(R.id.pro_img);
    proimg.setDrawingCacheEnabled(true);
    proimg.setImageBitmap(bmHalf);
    proimg.setVisibility(View.VISIBLE);
    proimg.setOnTouchListener(new View.OnTouchListener()
    {
      public boolean onTouch(View v, MotionEvent event) {
      ImageView view = (ImageView) v;
      int rotation = 25;
      // Dump touch event to log
      dumpEvent(event);
      // Handle touch events here...
      switch (event.getAction() & MotionEvent.ACTION_MASK) {
      case MotionEvent.ACTION_DOWN:
        savedMatrix.set(matrix);
        start.set(event.getX(), event.getY());
        Log.d(TAG, "mode=DRAG");
        mode = DRAG;
        proimg.invalidate();
        break;
      case MotionEvent.ACTION_MOVE:
        if (mode == DRAG) { 
// ...
                                                                                           matrix.set(savedMatrix);                                                            
        matrix.postTranslate(event.getX() - start.x,
        event.getY() - start.y);
       }
      else if (mode == ZOOM) {
         float newDist = spacing(event);
         Log.d(TAG, "newDist=" + newDist);
        if (newDist > 10f) {
        matrix.set(savedMatrix);
        float scale = newDist / oldDist;
        matrix.postScale(scale, scale, mid.x, mid.y);
        }
     }
    proimg.invalidate();
    break;
 }
      view.setImageMatrix(matrix);
    return true; // indicate event was handled
  }
 });
  canvas1.drawBitmap(downloaded_shirt_image, 50, 192, null);
 }

 if(downloaded_pant_image != null)
 {
  int width = downloaded_pant_image.getWidth();
  int height = downloaded_pant_image.getHeight();
  int halfWidth = width/3;
  int halfHeight = height/3;
  //Half Scaled
  Bitmap bmHalf = Bitmap.createScaledBitmap(downloaded_pant_image,
                  halfWidth, halfHeight, false);
  pantimg =(ImageView)findViewById(R.id.pro_img_down);
  pantimg.setDrawingCacheEnabled(true);
  pantimg.setImageBitmap(bmHalf);
  pantimg.setVisibility(View.VISIBLE);
  pantimg.setOnTouchListener(new View.OnTouchListener()
  {
   public boolean onTouch(View v, MotionEvent event) {
   ImageView view = (ImageView) v;
   int rotation = 25;
   // Dump touch event to log
   dumpEvent(event);
  // Handle touch events here...
  switch (event.getAction() & MotionEvent.ACTION_MASK) {
  case MotionEvent.ACTION_DOWN:
  savedMatrix.set(matrix);
  start.set(event.getX(), event.getY());
  Log.d(TAG, "mode=DRAG");
  mode = DRAG;
  pantimg.invalidate();
  break;
 case MotionEvent.ACTION_MOVE:
  if (mode == DRAG) {
  // ...

 matrix.set(savedMatrix);                                              matrix.postTranslate(event.getX() - start.x,
 event.getY() - start.y);
 }
else if (mode == ZOOM) {
float newDist = spacing(event);
Log.d(TAG, "newDist=" + newDist);
if (newDist > 10f) {
matrix.set(savedMatrix);
float scale = newDist / oldDist;
matrix.postScale(scale, scale, mid.x, mid.y);
}
}
pantimg.invalidate();
break;
}
view.setImageMatrix(matrix);
return true; // indicate event was handled
}
}                            
);
canvas1.drawBitmap(downloaded_pant_image, 110, 565, 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-05T22:38:29+00:00Added an answer on June 5, 2026 at 10:38 pm

    Please see following link’s Answer and Comments also, it may help you.

    Drag & Drop Two Images

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

Sidebar

Related Questions

I have declared a string in my strings.xml file , and using it in
I want to parse a large XML file and I have two options: Perl
I have declared a bean in student.xml file: <bean id=student1 class=com.raykor.hello.Spring3HelloWorld> <property name=name value=Sachin
In my project.gwt.xml file I have <script src=http://maps.google.com/maps?gwt=1&amp;file=api&amp;v=2&amp;sensor=false;key=MYKEY /> But, when I load my
In my foo_layout.xml file I have a subclassed RelativeLayout: <?xml version=1.0 encoding=utf-8?> <FrameLayout xmlns:android=http://schemas.android.com/apk/res/android
I would like to update an xml file from another xml file.I have used
I have a request that returns a large xml file. I have the file
What is the easiest way to convert xml to html? I have xml file
So I have an XML file that I am trying to loop through in
HI I have an xml file with 500KB size which i need to send

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.