Using Ontouch and Onclick for an ImageButton?

Welcome to ScriptMode
Posts: 36
Joined: Tue Aug 25, 2015 9:39 am

Using Ontouch and Onclick for an ImageButton?

Postby Rami » Wed Mar 02, 2016 7:08 am

I want these two things in my application.
When i touch and drag the imagebutton, it should move along with my finger.

i used OnTouchListener() for this and it works fine.

when i click the imagebutton, it should close the activity.

i used OnClickListener() for this and it also works fine.

So, here is my problem. whenever i move the imagebutton OnTouchListener is tirggered and the imagebutton moves, the OnClickListener is also triggered at the end when i am releasing the button from moving.

How can i use it?

Return to “General”

Who is online

Users browsing this forum: No registered users and 3 guests