Java tutorial
//package com.java2s; //License from project: Apache License import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.support.annotation.NonNull; public class Main { /** * Returns true if an activity with the given intent is successfully started * @param context * @param intent * @return */ protected static boolean startActivity(@NonNull Context context, Intent intent) { try { context.startActivity(intent); } catch (ActivityNotFoundException ae) { return false; } return true; } }