工作环境(蓝色粗体字为特别注意内容)
1,系统环境:Win7 Ultimate sp1、Android Studio 3.2
很奇怪,今天在使用Bundle在Activity之间传值的时候,居然无法获取传入的值,且看传值代码:
Bundle bundle = new Bundle();
bundle.putInt(EXAM_CENTER_TYPE, EXAM_CENTER_1);
toActivity(ExamTypeActivity.class, bundle);
protected void toActivity(Class<?> clazz, Bundle bundle) {
Intent intent = new Intent();
intent.setClass(this, clazz);
if (bundle != null) {
intent.putExtras(bundle);
}
startActivity(intent);
}
取值代码:
protected Bundle getExtra() {
Intent intent = getIntent();
if (intent != null) {
return getIntent().getExtras();
} else {
return null;
}
}
protected String getExtraString(S