Skip to content

Instantly share code, notes, and snippets.

@nipundavid nipundavid/PluginClass.java Secret
Created Jul 8, 2017

Embed
What would you like to do?
Singleto class to call toast
package com.plugin.android.unityplugin;
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.