peternorbeck
6/8/2015 - 9:31 AM

Android

Android

/**
 * Toast Crashes Android App fix 
 * Toast is a UI element so it needs to run on the UI Thread, not a background Thread.
 *  
 *  @See http://developer.android.com/reference/android/app/Activity.html#runOnUiThread(java.lang.Runnable)
*/

runOnUiThread(new Runnable() {
    public void run()
    {
        Toast.makeText(getApplicationContext(), "The Toast Message goes here.", Toast.LENGTH_SHORT).show();
    }
});