سؤال

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