Android examples for android.app:Activity Start
restart activity
import android.app.Activity; import android.content.Intent; public class Main{ public static void restart(final Activity thiz) { restart(thiz, thiz.getIntent()); }/*from w w w . ja v a2 s. com*/ public static void restart(final Activity thiz, Intent intent) { intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); thiz.overridePendingTransition(0, 0); thiz.startActivity(intent); thiz.overridePendingTransition(0, 0); int flags = intent.getFlags(); boolean isClearTop = (flags & Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0; boolean isSingleTop = (flags & Intent.FLAG_ACTIVITY_SINGLE_TOP) != 0; if (!isClearTop && !isSingleTop) { thiz.finish(); } } }