In my code, ontouch listener of a button is fired twice.
please find below the code. I am using Google API 2.2.
Code in java file ….
submit_button = (Button)findViewById(R.id.submit);
submit_button .setOnTouchListener(new View.OnTouchListener()
{
public boolean onTouch(View arg0, MotionEvent arg1) {
int action=0;
if(action == MotionEvent.ACTION_DOWN)
{
startActivity(new Intent(First_Activity.this, Second_Activity.class));
finish();
}
return true;
}
});
Please help me on solving this issue.
instead of using onTouchListener, you should use onClickListener for buttons.