I use onLongClick and onClick events of a button to get user inputs. Whenever; the user long click and triggers onLongClick event, the onClick event is also triggered. I couldn't find my problem. The code of two methods are shown in below:
@Override
public void onClick(View v) {
switch(((Button) v).getId())
{
case R.id.enter:
EntertheNumber();
break;
case R.id.clear:
CleartheNumber();
break;
case R.id.number_zero:
case R.id.number_one:
case R.id.number_two:
case R.id.number_three:
case R.id.number_four:
case R.id.number_five:
case R.id.number_six:
case R.id.number_seven:
case R.id.number_eight:
case R.id.number_nine:
AddtotheNumber(mEditor, (Button) v);
break;
}
@Override
public boolean onLongClick(View view) {
if(SMBGuesstheNumber.bDisplayFlagList)
{
theActiveButton = (Button) view;
showDialog(R.id.display_flaglist);
}
return false;
}
Actually, my project is Open Source. So, you can find all the code at http://code.google.com/p/guessthenumber/
Thank you.