Java tutorial
//package com.java2s; import android.app.Application; import android.content.Context; import android.content.Intent; public class Main { static void resolveIntent(Intent intent, Context context) { if (context instanceof Application) { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); } context.startActivity(intent); } }