回到以前的活动

时间:2012-02-10 09:50:16

标签: android android-activity superclass

我尝试转到上一个活动(活动A),但有问题。对此的命令进入活动B,我不会回到B:

A:

if(...)
{
   B.staticF();
}

B:

static void staticF()
{
   super.onBackPressed();
}

但我不能使用super,因为它是静态上下文。

当然,我可以致电

Intent i = new Intent(this, B.class);
startActivity(i);

但我不会保存B看。

1 个答案:

答案 0 :(得分:1)

为什么不使用像共享偏好这样的东西来保存状态呢?然后使用intent返回并在onCreate方法中获取首选项并使用要保存的数据填充任何视图

相关问题