Java tutorial
//package com.java2s; //License from project: Apache License import android.annotation.SuppressLint; import android.content.Context; import android.view.View; import android.widget.Toast; public class Main { private static Toast toast; private static View view; @SuppressLint("ShowToast") private static void getToast(Context context) { if (toast == null) { toast = new Toast(context); } if (view == null) { view = Toast.makeText(context, "", Toast.LENGTH_SHORT).getView(); } toast.setView(view); } }