Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;

import android.widget.Toast;

public class Main {
    private static Toast mToast;

    public static void showShortToast(Context context, String msg) {
        showToast(context, msg, Toast.LENGTH_SHORT);
    }

    private static void showToast(Context context, String msg, int duration) {
        if (mToast != null)
            mToast.cancel();
        mToast = Toast.makeText(context, msg, duration);
        mToast.show();
    }
}