Java tutorial
//package com.java2s; import android.content.Context; import android.widget.Toast; public class Main { public static void checkNullStateByBoolean(Context context, boolean empty, String message) { if (empty) { Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); throw new IllegalStateException(message); } } }