Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.Intent; public class Main { /** * Safely wrapper of {@link Context#startActivity(Intent)}. * * @param context * @param intent * * @return True means start success, otherwise false. */ public final static boolean startActivitySafely(Context context, Intent intent) { try { context.startActivity(intent); return true; } catch (Exception e) { e.printStackTrace(); return false; } } }