0

I am writing a keyboard replacement app for Android, and based on the user's touch, a different image is rendered in a specified ImageView. I am running into an issue with two things:

1) With the tablet, I can move my finger quicker, so the onTouch method I am using is losing touch events. For instance, in a quick circle, my touch pattern looks like this:

x: 590.0 y: 178.0
x: 488.0 y: 172.0
x: 233.0 y: 416.0
x: 394.0 y: 451.0
x: 575.0 y: 199.0
x: 450.0 y: 170.0
x: 341.0 y: 193.0

(using Logcat and event.getX(), event.getY())

Is there a better way track events with a tablet to pick up more events?

2) The changing image in the imageview renders slower than in the phone app. Is there a way to fix this, or is it a limitation of the tablet? I change the imageview by:

myImageView.setImageDrawable(image);

Any ideas?

coder
  • 10,460
  • 17
  • 72
  • 125

2 Answers2

0

I get much better performance pre-decoding it via BitmapFactory, which should look something like this (untested):

myBitmap=BitmapFactory.decodeResource(myImageView.getContext().getResources(),R.res.drawable.my_image);
//later
myImageView.setImageBitmap(myBitmap);
yingted
  • 9,996
  • 4
  • 23
  • 15
0

You could try a custom view and onTouch event. You would have to pre-load all your buttons states as bitmaps.

See this example: Make certain area of bitmap transparent on touch

Community
  • 1
  • 1
Lumis
  • 21,517
  • 8
  • 63
  • 67