Creating OnTouch Toast notifications

Put your problem here if it does not fit any of the other categories.

Creating OnTouch Toast notifications

Postby ruerric » Sat Apr 09, 2011 9:49 pm


I am new to java and trying to create some fun applications for android..
I was able to implement the One Finger zoom but I would like to add additional functionality..
I want to create a toast notification appear onTouch every zoom in..

I think the code I need to implement the toast

public boolean onTouch(View v, MotionEvent event) {
final int action = event.getAction();
final float x = event.getX();
final float y = event.getY();

if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();

switch (action) {
case MotionEvent.ACTION_DOWN:
v.postDelayed(mLongPressRunnable, mLongPressTimeout);
mDownX = x;
mDownY = y;
mX = x;
mY = y;

Context context = getApplicationContext();
CharSequence text = "Hello toast!";
int duration = Toast.LENGTH_SHORT;

Toast toast = Toast.makeText(context, text, duration);;

How am I suppose to implement it so onZoom, it will toast displaying the x,y, coordinates on the bitmap?
Posts: 3
Joined: Sat Mar 19, 2011 11:21 pm


Return to Other Coding-Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 21 guests