目前我遇到了一个错误,如果用户快速点击一个按钮,按钮附加的意图将多次触发,导致该意图的堆栈需要再次追溯。 我怎样才能避免这种情况或解决这个问题?
谢谢~k
这是onClickListener的内部。 我在这里设置布尔值,然后在进程结束时取消设置。
if(!isDating) { intent.setClass(context, EventDate.class); isDating = true; ((TabGroupActivity) context).startChildActivity("EventDate",intent); }Currently I'm experiencing a bug where if the user quickly taps a button, the intent that the button is attached to will fire off multiple times, resulting in a stack of that intent that will need to be back traced through again. How can I avoid this or remedy this?
Thanks ~k
This is inside of the onClickListener. I set the boolean value here, then I unset it at the end of the process.
if(!isDating) { intent.setClass(context, EventDate.class); isDating = true; ((TabGroupActivity) context).startChildActivity("EventDate",intent); }最满意答案
尝试为意图设置标志
intent.setFlags(FLAG_ACTIVITY_BROUGHT_TO_FRONT);您还可以通过Application部分中的AndroidManifest.xml文件设置此标志。 首选此方法。
使用Manifest文件更新launchMode
希望这能解决你的问题。
Actually I found a better solution!
by setting the onClickListener(null); then recreating it onResume, it bypasses having to use flags and what not.
!k
更多推荐
发布评论