Possible Duplicate:
How do I make a toast from a non activity class?
How can I create and show a Toast
message from a class which does not extended the Activity
class? I'm using this class in another class that is extended by Activity
.
You need a context Reference. Just have a helper method like
public static void showToastMethod(Context context) {
Toast.makeText(context, "mymessage ", Toast.LENGTH_SHORT).show();
}