package com.tam.tuane.tuplay.Ui.view.componet;

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

/**
 * Created by Tuane on 2016/11/23.
 */

public class SingleToast {

    private static Toast singleToast = null;

    /**
     * Immediately shows a text message.
     * Use this the same way you would call 'Toast'
     *
     * @Note It calls "show()" immediately.
     */

    public static void show (Context c, String text, int duration) {

        if(singleToast != null){
            singleToast.cancel();
        }

        singleToast = Toast.makeText(c, text, duration);
        singleToast.show();
    }
}
