Skip to content

Instantly share code, notes, and snippets.

@nipundavid nipundavid/ Secret
Created Jul 8, 2017

What would you like to do?
Singleto class to call toast
import android.content.Context;
import android.widget.Toast;
* Created by nipundavid on 6/19/2017.
public class PluginClass {
private Context context;
private static PluginClass instance;
public PluginClass() {
this.instance = this;
public static PluginClass instance() {
if(instance == null) {
instance = new PluginClass();
return instance;
public void setContext(Context context) {
this.context = context;
public void showMessage(String message) {
Toast.makeText(this.context, message, Toast.LENGTH_SHORT).show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.