有三个Activit,分别为Activity1,2,3现在从Activity1跳转到2然后再跳转到3,可以把Activity3的值用startActivityForResult方法返回给Activity1么?Activity1没有直接跳转到Activity3
使用SharedPreferences保存第三个界面的信息,在第一个页面调用this.getSharedPreferences('sharedPreference name' int mode);
还可以一个一个页面传值 或者定义全局变量
这个方法可以么?
Intent intent = new Intent(Activity1.this, Activity3.class);
startActivity(intent);
这个方法可以么?
Intent intent = new Intent(Activity1.this, Activity3.class);
startActivity(intent);
publicString getValue(Context context)
{
SharedPreferences setting = context.getSharedPreferences(
Constants.LOGIN_INFO, MODE_PRIVATE);
String value= setting.getString("name", null);
return value;
}
public void saveValue(Context context, String value)
{
SharedPreferences setting = context.getSharedPreferences(
Constants.LOGIN_INFO, MODE_PRIVATE);
SharedPreferences.Editor editor = setting.edit();
editor.putString("value", value);
editor.commit();
}