我有一个更长的pressed pressed状态按钮的运动类。它工作得很好!android:Activity使用OnTouchListener()启动2次
但是,有没有人知道为什么在这个代码块我的活动开始2次?当我按下后退按钮时,我必须做2次。
Thx任何帮助!
这是我的Java代码:
Button MenuBtnStart;
final Handler handlerBtnStart = new Handler();
MenuBtnStart.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(final View v, MotionEvent event) {
MenuBtnStart.setBackgroundDrawable(getResources().getDrawable(R.drawable.hover));
v.setPressed(true);
handlerBtnStart.postDelayed(new Runnable() {
public void run() {
Intent myIntent = new Intent(TextActivity.this, NextActivity.class);
TextActivity.this.startActivity(myIntent);
v.setPressed(false);
}
}, 900); // end of Handler new Runnable()
return true;
}
}); // end of OnTouchListener()
我现在得到一个未捕获的异常错误,whats错误其他? thx很多4帮助! – synthesis 2012-08-02 17:54:51
您可以将完整的LogCat放在pastebin上并将其链接到此处吗? – Eric 2012-08-02 17:57:20
我有一个文本文件 – synthesis 2012-08-02 18:00:43