Mega Code Archive

 
Categories / Android / UI
 

Make Toast Text

//package djrain.lib; import android.content.Context; import android.widget.Toast; public class ToastEx {   private static Toast showing; //  public static void makeText(Context context, String text) //  { //    if (showing != null) //    { //      showing.cancel(); //      showing = null; //    } //    showing = Toast.makeText(context, text, Toast.LENGTH_SHORT); //    showing.show(); //  }   public static void makeText(Context context, String text)   {     if (showing == null)     {       showing = Toast.makeText(context, text, Toast.LENGTH_SHORT);     }     else     {       showing.setText(text);     }     showing.show();   } }