Use this:
public static void showToast(Context context, String text) {
Toast.makeText(context, text, Toast.LENGTH_LONG).show();
}
now for calling this method you should call like this:
ClassName.showToast(context,"text");
Here classname is class that containing static method.
0
solved Create Toast by a static method