On Sun, Jul 11, 2010 at 8:32 PM, Kris Skarbø <[email protected]> wrote: > I have a Button and a numeric TextView. When I longpress the Button i > want the value in the TextView to increase. > > Could someone assist me with the code inside the "onLongClick" method?
tv.setText(String.valueOf(i+=1)); > Does it start a Timer which calls on a background thread which > increases the number? Why? A long-click is a single event, so you only increment the counter by one. > Do i do a simple while-button-is-clicked loop? There is no "while-button-is-clicked" concept in Android. A long click does not occur until the user has lifted their finger off of the screen. It would seem that what you want is not onLongClick(), but onTouchEvent(). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

