Android Build a Simple Android App with Java Testing and Debugging Toast Notifications

Ema Johnston
Ema Johnston
1,917 Points

Hi, When enter the Toast activity to FunFacts activity I get red squiggly lines?

Build a simple app with Java. Debugging

Toast.makeText( context: this, text: "Yay! our activity was created", Toast.LENGTH_SHORT).show();

I get red squiggly lines under 'context:','text:','show'?

The error is that it cannot "resolve them". I picked on each word to alt, enter but I'm not sure what to choose.

2 Answers

Jamen Huang
Jamen Huang
7,651 Points

may be try something like --- Toast.makeText( context: funFactsActivity.this, text: "Yay! our activity was created", Toast.LENGTH_SHORT).show();

Ema Johnston
Ema Johnston
1,917 Points

Sorted! I should have chosen the option to type Toast. (then choose the autocomplete from the drop-down menu "Create new Toast." I had typed this in manually which it didn't like at all.

Ema Johnston
Ema Johnston
1,917 Points

Hi Jamen, Thank you for your reply. Yes, this seems to work too. However, it still has the same error messages. I'll have another wee fiddle with it :-)