[android-developers] Re: onLongClickListener is driving me batshit crazy
Okay.... so it seems the problem is Activity 2 has a timer that updates a text field with the number of seconds left in the game.
This is done via:
protected View timerCallbackView;
protected TimerTask timerTask;
private final long interval = 500L;
class TimerTask implements Runnable {
public void run() {
Activity_BaseClassWithTimers.this.UpdateTimer();
}
}
protected void createTimer() {
if (timerTask == null) {
timerTask = new TimerTask();
}
}
protected void startTimer() {
if (timerCallbackView != null) {
// sometimes onResume() is called during startup, so we could have 2 timers is we don't remove the duplicate!
timerCallbackView.removeCallbacks(timerTask);
timerCallbackView.postDelayed(timerTask, interval);
}
}
protected void UpdateTimer() {
// update timer text view
....
startTimer();
}
Here is the HORRID part: If I set the timer interval to 500msec .... the onLongClickListener works! But it does not work at 200msec ! WTF ?
Ideas ?
On Friday, May 17, 2013 10:05:10 AM UTC-4, Mind wrote:
I have two activities. Each activity has a viewpager. The adapter for each viewpager instantiates a number of views.--
One of the views (let's call it ViewA) is a custom listview which populates itself with data from the internet. ViewA is instantiated in each Activity's ViewPager's Adapter and shown correctly. It pulls data from the internet and updates its display correctly. ViewA also includes a onLongClickListener, which is added to each row in the ListView by the ListView's adapter.
Now this is the batshit crazy part. In Activity 1, the onLongClickListener works. In Activity 2, it does not get called. However both ViewPager's Adapters instantiate ViewA (which is fully self contained).
For debugging, I can directly overlay a onLongClickListener after ViewA instantiation in the ViewPager Adapter, and that works. However, lower down in my custom view, it never recieves the longClick... but ONLY when instantiatiated in Activity 2. Activity1 works fine.
Hopefully this makes sense to someone and you can give me some pointers on how to debug this ?
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home