show Error Message using Toast - Android android.widget

Android examples for android.widget:Toast

Description

show Error Message using Toast

Demo Code

import android.content.Context;
import android.widget.Toast;

public class Main{

    public static void showErrorMessage(Context context, Throwable ex) {
        Toast.makeText(context, ex.getLocalizedMessage(), Toast.LENGTH_LONG)
                .show();/*from  w ww  .  j a v  a2  s . c  o m*/
    }
    public static void showErrorMessage(Context context, int message,
            Object... args) {
        Toast.makeText(context, context.getString(message, args),
                Toast.LENGTH_LONG).show();
    }

}

Related Tutorials