第一项活动
Intent intent = new Intent(InvestmentDetail_Activity.this, InvestmentUpdate_Activity.class);
intent.putExtra("Interval", Iinterval); //integer value
startActivity(intent);
第二项活动
if (I_interval != null) {
I_interval=Integer.valueOf(getIntent().getStringExtra("Interval"));
}
if (I_interval != null) {
switch (I_interval) {
case 1:
toggleOne.setChecked(true);
due_time_int = 1;
break;
case 3:
toggleThree.setChecked(true);
due_time_int = 3;
break;
case 6:
toggleSix.setChecked(true);
due_time_int = 6;
break;
case 12:
toggleTwelve.setChecked(true);
due_time_int = 12;
break;
default:
break;
}
}//code is not working
答案 0 :(得分:2)
正如您所提到的,您正在从Integer
intent
值
intent.putExtra("Interval", Iinterval); //integer value
所以,你需要改变这个
I_interval=Integer.valueOf(getIntent().getStringExtra("Interval"));
到
I_interval=Integer.valueOf(getIntent().getIntExtra("Interval"));