So I am learning how to make an android app and I am trying to make a method that shows a simple toast message and I have the following code:
public void showMessage(String message){
Toast.makeText(this.context, message, Toast.LENGTH_SHORT);
}
and I get the error:
Cannot resolve method 'makeText(Context, java.lang.String, int)'
this.context is a Context object and I can see according to the documentation on android studio that makeText(Context, CharSequence, int) is a valid method, but it won't accept it. I've tried using CharSequence as my parameter instead of String and I get the same error. What am I doing wrong?