0

MyActivity started by another Activity (different process) with extra string value in intent.

If it reboots itself through MyActivity::restart() like following, extra string value will be received again in MyActivity::onCreate(). That is what I do NOT want.

Is it a wrong way to reboot ?

class MyActivity extends Activity
{
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        String value = getIntent().getStringExtra("Key");
        //Log shows value
    }

    public void restart()
    {
        onDestroy();
        System.exit(0);
    }
}
RoFF
  • 529
  • 5
  • 27
  • 1
    oh my god what is this, manual call to ondestroy() and system.exit() on android that is WRONG ( http://stackoverflow.com/questions/10146906/placing-a-call-to-ondestroy-inside-onpause-good-idea-to-guarantee-activity and http://stackoverflow.com/questions/18292016/difference-between-finish-and-system-exit0 ) – EpicPandaForce Jul 11 '14 at 09:29
  • you can refer this link on SO http://stackoverflow.com/questions/6609414/howto-programatically-restart-android-app[enter link – ORIGINAL Jul 11 '14 at 09:32

0 Answers0