• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to detect the click event and the swipe event differently

 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have an android app which contain view pager.I need to identify click event and the swipe event differently.I already overrides the onInterceptTouchEvent.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this was my problem I'd leave onInterceptTouchEvent alone and handle different events with different listeners, in this case View.OnClickListener and ViewPager.OnPageChangeListener.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a viewpager with images.I need to do something when i click images.I implement the onclick listener for view






but the when i click on the image it doesn't work the onclick listener?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why aren't you attaching the OnClickListener to the ImageView if it's clicks on the image that you're actually interested in?
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I need to call another activity when i click the image.But it is unable to call another activity inside this?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does it matter what you do in a listener for where you attach it?
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because i get the image in adapter,i added the onclickListener inside the adapter.but i am unable to call the another activity via intent.is there any other way to do this ulf ?
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ulf ,i attached the listener to image.Is there any other way to do this ?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you ask?
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to call another activity when i click on the image.I have posted the my code above.But i am unable to call the activity via intent inside instantiateItem in adapter.Is there anything wrong in my code or any other place to call activity ?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because i get the image in adapter,i added the onclickListener inside the adapter.but i am unable to call the another activity via intent.is there any other way to do this ulf ?

This reasoning is fundamentally flawed. You assume because something you implemented didn't work it was the wrong way to implement it. Pardon me for being frank, but given the history of your Android development efforts as documented by your posts here, your first assumption should be that you made a mistake somewhere.

I need to call another activity when i click on the image.I have posted the my code above.But i am unable to call the activity via intent inside instantiateItem in adapter.Is there anything wrong in my code or any other place to call activity ?

What you posted doesn't even compile. If there are problems -as I've told you many times before, but unfortunately you insist on ignoring it, which is getting extremely tiresome- you need to tell us what you are doing, what you expected to happen in response, and what is actually happening. Post the values of all involved variables, the stack trace of all exceptions if there are any, etc. etc.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that is not compiling.I need to call another activity when i click the images.I am unable to call the activity inside the above call.Its not compiling.

 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you don't mention it, I assume that you agree now that the kind of listener is irrelevant?

As I said, if there are error messages, post them. This latest code doesn't even try to start to start an activity, so it is even less clear than before what "I am unable to call the activity" means.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok ulf.If this is not the correct approach,what kind of approach is good.I found that using interface w can call activity method.Is it suit for this one?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm giving up, as this is getting too frustrating. You seem to be paying no attention whatsoever to what you are being told. Good luck.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the answer.We can use activity reference inside to call Intent.Below is the code



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic