show Error Message via Toast - Android User Interface

Android examples for User Interface:Toast

Description

show Error Message via Toast

Demo Code


//package com.java2s;
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  .jav  a2 s  . co  m
    }

    public static void showErrorMessage(Context context, int message,
            Object... args) {
        Toast.makeText(context, context.getString(message, args),
                Toast.LENGTH_LONG).show();
    }
}

Related Tutorials