andro-girl
andro-girl

Reputation: 8129

on touch event in android

i have a screen which is showing some information about version.there is no controll in the screen.i want to finish this activity when i tap on the screen.can anyone help me plz...

Upvotes: 1

Views: 1318

Answers (3)

Aleadam
Aleadam

Reputation: 40401

Make your activity implement OnTouchListener:

public class MyActivity extends Activity implements OnTouchListener{

// All your code goes here

@Override
    public boolean onTouch(View arg0, MotionEvent arg1) {
        this.finish();
        return false;
    }
}

Upvotes: 7

rekaszeru
rekaszeru

Reputation: 19220

You could override your activity's onTouchEvent method to finish it:

@Override
public boolean onTouchEvent(MotionEvent event)
{
    this.finish();
    return true;
}

Upvotes: 4

pumpkee
pumpkee

Reputation: 3357

Override onTouchEvent in your activity.

 @Override 
public boolean onTouchEvent (MotionEvent e) {
    this.finish();
    return false;

}

Upvotes: 1

Related Questions