I got confused about restarting activity. I have two functions that work well for the same task. Please help me which is better and why?
public void restart()
{
Intent intent = getIntent();
overridePendingTransition(0, 0);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
finish();
overridePendingTransition(R.anim.fade,R.anim.fade);
startActivity(intent);
}
or
public void restart()
{
onCreate();
}
Thanks in advance?
source
share