[android-developers] Re: Missing ACTION_UP
Did you add clickable=true to your View? On 4 Лис, 23:17, Bret Foreman bret.fore...@gmail.com wrote: These views are inside an ExpandableListView, which is known to have a number of bugs around text selection. This is just another in a list of issues with that widget. I need to pass the event up the stack because it also expands/collapses the rows in the ListView. Somebody should really rewrite ExpandableListView...though I'm not volunteering! On Nov 4, 2:06 pm, niko20 nikolatesl...@yahoo.com wrote: I don't know why you had a problem with this in the first place. I have custom views where I override the OnTouch and I get ACTION_DOWN and ACTION_UP messages just fine. Also, why do you want to pass the message to the parent anyway? I don't see a need for this. -niko On Nov 4, 3:23 pm, Bret Foreman bret.fore...@gmail.com wrote: Ah, good point.That makes the hack a little simpler. It's still an ugly hack. On Nov 4, 1:09 pm, Kostya Vasilyev kmans...@gmail.com wrote: 04.11.2010 23:01, Bret Foreman ?: Of course, there's another method to set myParent. Could be like this: arg0.getParent() Or (assuming the listener is an inner class) getParent() -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Missing ACTION_UP
So I set an onClickListener for the view and got the correct behavior. I do the highlight background in the onTouchEvent and then remove the background in the onClickListener. It's not pretty, but I don't see any other way, since ACTION_UP never seems to occur. However, this creates another problem. The view is swallowing the click and I want it passed up to the parent for other processing. Is there a method I can call in the onClickListener to cause the click to be passed up the view stack rather than consumed? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Missing ACTION_UP
It's unfortunate that onClick and onTouch do not use the same approach, where the method returns a true if it handled the event and the parent shouldn't get the event a false if the parent should get the event. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Missing ACTION_UP
Well, if the docs say it clearly, its fine I guess. On 04-Nov-2010 11:38 PM, Bret Foreman bret.fore...@gmail.com wrote: It's unfortunate that onClick and onTouch do not use the same approach, where the method returns a true if it handled the event and the parent shouldn't get the event a false if the parent should get the event. -- You received this message because you are subscribed to the Google Groups Android Developers ... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Missing ACTION_UP
True, except the inconsistency results in an incompleteness. The onClick documentation doesn't state what mechanism has been created in the onClick case to produce the same effect as returning a false in the onTouch case. On Nov 4, 11:10 am, Kumar Bibek coomar@gmail.com wrote: Well, if the docs say it clearly, its fine I guess. On 04-Nov-2010 11:38 PM, Bret Foreman bret.fore...@gmail.com wrote: It's unfortunate that onClick and onTouch do not use the same approach, where the method returns a true if it handled the event and the parent shouldn't get the event a false if the parent should get the event. -- You received this message because you are subscribed to the Google Groups Android Developers ... -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Missing ACTION_UP
It occurs to me that this may be a consequence of the _kind_ of view I'm using. In this case, it's a TextView. I notice that the only onTouch event that the default TextView passes to my onTouch method is ACTION_DOWN. I'm guessing I need to set some flags elsewhere to get other events for this type of view. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Missing ACTION_UP
Scanning through the TextView docs did not reveal any flags that I think would effect whether or not the ACTION_UP event was passed to onTouch. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Missing ACTION_UP
Now here's an AMAZING thing. When I change onTouch to return true (indicating that the event is handled) then the ACTION_UP event _is_ passed to onTouch. So returning false as a result of the ACTION_DOWN somehow tells the stack to pass the subsequent ACTION_UP to onTouch. This is not a fix, however, since I need to pass the event to the upper view layers for other processing. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Missing ACTION_UP
It looks like the only workaround is brute force. I can extend TextView to add a myParentView variable and then call the myParentView.onTouchEvent. Of course I'll also return true from onTouch so that I will successfully receive the ACTION_UP event. But what a hack! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Missing ACTION_UP
OK, just for the reference of others, there's the fix, which works. Returning true means the subsequent ACTION_UP is received. calling the onTouchEvent method of the parent ensures that the event gets passed up the stack. Of course, there's another method to set myParent. @Override public boolean onTouch(View arg0, MotionEvent event) { switch( event.getAction() ){ case MotionEvent.ACTION_DOWN: setBackgroundResource(R.color.on_touch_orange); break; case MotionEvent.ACTION_UP: setBackgroundResource(0); break; } if( myParent != null ) { myParent.onTouchEvent(event); } return true; }} ); -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Missing ACTION_UP
04.11.2010 23:01, Bret Foreman ?: Of course, there's another method to set myParent. Could be like this: arg0.getParent() Or (assuming the listener is an inner class) getParent() -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Missing ACTION_UP
Ah, good point.That makes the hack a little simpler. It's still an ugly hack. On Nov 4, 1:09 pm, Kostya Vasilyev kmans...@gmail.com wrote: 04.11.2010 23:01, Bret Foreman ?: Of course, there's another method to set myParent. Could be like this: arg0.getParent() Or (assuming the listener is an inner class) getParent() -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Missing ACTION_UP
I don't know why you had a problem with this in the first place. I have custom views where I override the OnTouch and I get ACTION_DOWN and ACTION_UP messages just fine. Also, why do you want to pass the message to the parent anyway? I don't see a need for this. -niko On Nov 4, 3:23 pm, Bret Foreman bret.fore...@gmail.com wrote: Ah, good point.That makes the hack a little simpler. It's still an ugly hack. On Nov 4, 1:09 pm, Kostya Vasilyev kmans...@gmail.com wrote: 04.11.2010 23:01, Bret Foreman ?: Of course, there's another method to set myParent. Could be like this: arg0.getParent() Or (assuming the listener is an inner class) getParent() -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Missing ACTION_UP
These views are inside an ExpandableListView, which is known to have a number of bugs around text selection. This is just another in a list of issues with that widget. I need to pass the event up the stack because it also expands/collapses the rows in the ListView. Somebody should really rewrite ExpandableListView...though I'm not volunteering! On Nov 4, 2:06 pm, niko20 nikolatesl...@yahoo.com wrote: I don't know why you had a problem with this in the first place. I have custom views where I override the OnTouch and I get ACTION_DOWN and ACTION_UP messages just fine. Also, why do you want to pass the message to the parent anyway? I don't see a need for this. -niko On Nov 4, 3:23 pm, Bret Foreman bret.fore...@gmail.com wrote: Ah, good point.That makes the hack a little simpler. It's still an ugly hack. On Nov 4, 1:09 pm, Kostya Vasilyev kmans...@gmail.com wrote: 04.11.2010 23:01, Bret Foreman ?: Of course, there's another method to set myParent. Could be like this: arg0.getParent() Or (assuming the listener is an inner class) getParent() -- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en