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.view.Gravity;

import android.widget.Toast;

public class Main {
    public static void ShowToast(Context context, int nStringId) {
        ShowToast(context, context.getString(nStringId));
    }

    public static void ShowToast(Context context, String strMsg) {
        Toast toast = Toast.makeText(context, strMsg, Toast.LENGTH_LONG);
        toast.setGravity(Gravity.CENTER, 0, 0);
        toast.setDuration(1000);
        toast.show();
    }
}