Hy!
I want to make my own Exception Class, but my problem is that i don’T know how to access the Context to show a Toast for the user.
My Code:
public class NFFException extends Exception{
private static final long serialVersionUID = 1L;
public NFFException(String msg) {
Toast.makeText(???, msg, 300);
}
}
Since context is not static, so you can not use it in Exception class. One thing you can do, in any activity class, make a static field
static Context context;
initialize it in onCreate() method,
and then use this context variable in your above code