I'm starting an activity with startActivity() but there will be times when that activity is already active. In this case I'd like to be able to access extras in the onResume() method.

Is there a way to do this?

有帮助吗?

解决方案

not tested
just override onResume in activity class like this

@Override
protected void onResume() {
    // TODO Auto-generated method stub
    super.onResume();
    Intent intent = getIntent();
            intent.getExtras().getString("foo");
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top