Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: onTouchEvent for textView

I'm beginner developing developing small application. I have 3 textview on screen, when i touch the any one of the view it should navigate to next new screen, how to do this help me

Thanks,

Suhani

like image 364
suhani Avatar asked Sep 21 '26 05:09

suhani


1 Answers

yourTextView.setOnTouchListener(new OnTouchListener() {

    @Override
    public boolean onTouch(View v, MotionEvent event) {
        if (event.getAction() == MotionEvent.ACTION_UP) {
            // do something here when the element is clicked
            ScreenManager.setCurrent(new YourNewPage());
        }

        // true if the event was handled
        // and should not be given further down to other views.
        // if no other child view of this should get the event then return false

        return true;
    }
});
like image 118
Zidd0 Avatar answered Sep 23 '26 18:09

Zidd0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!