3

I'm trying to recreate() and activity on Android. I need additional data to be passed via an Intent to the recreated activity. How can this be done?

The following code does not work.

getIntent().putExtra("flag",true);
recreate();
blaffie
  • 505
  • 1
  • 10
  • 32

2 Answers2

1

You can call recreate() and save your date into SharedPreferences. In this way you are free to do many things and also the previous activity is completely destroyed before NewActivity begin. Take a look at this deep StackOverflow answer.

Soon Santos
  • 2,107
  • 22
  • 43
-1

Why don't you restart activity via Intent :

Intent intent = getIntent();
intent.putExtra("your","params");
finish();
startActivity(intent);