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.support.annotation.StringRes;
import android.text.TextUtils;
import android.widget.Toast;

public class Main {
    public static void showShort(Context context, String msg) {
        if (context != null && !TextUtils.isEmpty(msg)) {
            Toast.makeText(context.getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
        }
    }

    public static void showShort(Context context, @StringRes int resId) {
        if (context != null) {
            Toast.makeText(context.getApplicationContext(), resId, Toast.LENGTH_SHORT).show();
        }
    }
}