Nouran Ka

Nouran Ka

  • NA
  • 4
  • 566

Multiple Click Event for same button

Apr 25 2018 12:36 PM
Please help. I want to add multiple clicks to one button
I read on the site a solution to this problem and I tried it but did not succeed , began to implement the first condition only and ignore the second condition
How can I solve this dilemma?
This is the code you tried
 
Button b1;

int i=0;
 
b1=(Button) findViewById(R.id.btns);

b1.setOnClickListener( new View.OnClickListener() {
@SuppressLint("WrongConstant")
@Override
public void onClick(View view) {

if(i==0)
{
Intent in = new Intent();
in.putExtra( REG_INT_TAG, quantity1);
setResult(RESULT_OK,in);
finish();

}
else if(i==1)
{
Intent in = new Intent();
in.putExtra( REG_INT_TAG1, quantity1);
setResult(RESULT_OK,in);
finish();
}
i++;
}
} );