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()
© 2024 OneMinuteCode. All rights reserved.