Bitmap drwa on MotionEvent.ACTION_UP

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Bitmap drwa on MotionEvent.ACTION_UP

Postby rmeph » Thu Nov 20, 2008 1:26 pm

I have to draw one bitmap to another.second bitmap draw on MotionEvent.ACTION_UP for some second


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. resizedBitmap = Bitmap.createBitmap(image, 0, 0, image.getWidth(),
  2.  
  3.                                         image.getHeight(), matrix, true);
  4.  
  5. canvas.drawBitmap(resizedBitmap, (float) 0, (float) 0, new Paint());
  6.  
  7.                         if (draw) {
  8.  
  9. Bitmap bm = BitmapFactory.decodeResource(this.getResources(),
  10.  
  11.                                         R.drawable.bt);
  12.  
  13.                         canvas.drawBitmap(bm, (float) x, (float) y, new Paint());
  14.  
  15. draw = false;
  16.  
  17.         invalidate();
  18.  
  19.                         }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4



and on MotionEvent.ACTION_UP

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. case MotionEvent.ACTION_UP:
  2.  
  3.         draw = true;
  4.  
  5.         break;
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


but it code show second bitmap for almost 1 second..how to possible it show some more second??
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Top

Postby MrSnowflake » Thu Nov 20, 2008 1:42 pm

MotionEvent.ACTION_UP is not a fling or whatever in the up direction, it means you released your finger! You must find out which action got preformed yourself. Look at SnowServices I have a GestureRecognizer class in there, which should help you.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby rmeph » Thu Nov 20, 2008 2:03 pm

MrSnowflake wrote:MotionEvent.ACTION_UP is not a fling or whatever in the up direction, it means you released your finger! You must find out which action got preformed yourself. Look at SnowServices I have a GestureRecognizer class in there, which should help you.


MotionEvent.ACTION_UP is fling in my application.i want second bitmap draw some more time
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Postby rmeph » Thu Nov 20, 2008 2:30 pm

actually i want method same as sleep() method.............
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Postby MrSnowflake » Thu Nov 20, 2008 2:40 pm

I see it now, you should always keep drawing, because the canvas gets cleared every frame. so don't do draw = false; To make your thread sleep, use Thread.sleep(10);
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby rmeph » Thu Nov 20, 2008 2:44 pm

Already use it..but it's not working... :cry:
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Top

Postby rmeph » Thu Nov 20, 2008 3:29 pm

Anything else??
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 6 guests