Java tutorial
//package com.java2s; //License from project: Apache License import android.app.Activity; import android.content.Context; import android.content.Intent; public class Main { private static void checkContextIsActivity(Context a, Intent intent) { if (!(a instanceof Activity)) { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } } }