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

Hello,

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();
}
mVelocityTracker.addMovement(event);

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

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

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

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

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot] and 19 guests