Where knowledge empowers you to understand your world

Android Error: Cannot Resolve symbol ‘makeText’ in Toast

If you encounter an error that says ‘error: cannot find symbol’ or ‘Cannot resolve symbol makeText’, there are multiple possible causes. First, ensure that you have entered all the parameters correctly.

The Toast makeText function requires the following:

(Context, “String to display”, duration of Toast). Duration is an integer.

You can declare a context above using the following line:

Context examplecontext = getApplicationContext;

In your function, ensure that you are not using the ‘new’ operator to declare your Toast object.

Toast exampleToast = Toast.makeText(examplecontext, “Here’s your Toast message!”, Toast.LENGTH_LONG);

What not to do:

Toast exampleToast = new Toast.makeText(examplecontext, “Here’s your Toast message!”, Toast.LENGTH_LONG);