"Intent cannot be resolved to type error in eclipse

I am programming the first Android tutorial in eclipse and when compiling this code:

Intent intent = getIntent(); 

he gives an error

Intent cannot be allowed for type

How to fix it?

+6
source share
1 answer

Perhaps the import statement is missing. Try pressing Ctrl + Shift + O , Eclipse will automatically add an import statement if missing.

Then look at the top of the file and see what has been added. It should be something like this:

 import android.content.Intent; 
+19
source

Source: https://habr.com/ru/post/922093/


All Articles