I have an "Activity1" which has an "EditText". I want to open another activity "Activity2" when the user Double clicks on the "EditText".
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Use this:
final GestureDetector gestureDetector = new GestureDetector(context,new GestureDetector.SimpleOnGestureListener() {
public boolean onDoubleTap(MotionEvent e) {
Log.e("", "Open new activty here");
return true;
}
});
TextView tv = (TextView) findViewById(R.id.editTextID);
tv.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
return gestureDetector.onTouchEvent(event);
}
});