please help me! at first please follow this algorithm:
1- btn_set1
is clicked, its functions are doing.
2- btn_set2
is clicked, "text1" is SetText ed into "+"!!!
WHY??? please help me, how can i solve this problem? thanks.
public void onClick(View view) {
switch (view.getId()){
//time picker pannel
case R.id.btn_set1:
text1.setText(aTime);
intent1 = new Intent(this, alarmService.class);
intent1.putExtra("rq1", req_code);
intent1.putExtra("alarm_time", alarm_time1);
startService(intent1);
alinear.setAnimation(animLeft);
Linear.setVisibility(View.GONE);
text2.setVisibility(View.VISIBLE);
break;
case R.id.btn_set2:
text2.setText(aTime);
intent2 = new Intent(this, alarmService.class);
intent2.putExtra("rq2", req_code);
intent2.putExtra("alarm_time", alarm_time1);
startService(intent2);
LLinear.setAnimation(animLeft);
Linear.setVisibility(View.GONE);
case R.id.btn_cancle1:
Linear.setAnimation(animLeft);
Linear.setVisibility(View.GONE);
cancel_one(text1);
break;
case R.id.btn_cancle2:
Linear.setAnimation(animLeft);
Linear.setVisibility(View.GONE);
cancel_one(text2);
break;
}
}
private void cancel_one(TextView textView) {
if(intent1 != null)
stopService(intent1);
if(intent2 != null)
stopService(intent2);
textView.setText("+");
}
You forgot to put a break
statement in the case 2:
and hence case 3:
also gets invoked called when case 2
is invoked