public static void restartActivity(Activity act){
Intent intent=new Intent();
intent.setClass(act, act.getClass());
act.startActivity(intent);
act.finish();
}
This is the restart method that I created. It doesn't work properly and turns off immediately.
android android-activity
Intent intent = getIntent();
finish();
startActivity(intent);
I think you should change the order Like the code above. finish() is called first and the same intend is started anew.
There's a method called Activity.recreate(). reCreate()
914 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
581 PHP ssh2_scp_send fails to send files as intended
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
610 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.