Reputation: 17
I have my Spinner which is an object of the class SpinnerAdapter. I try to create the object but there is an errors I try to solve it but I can not.
Here is a picture of error that happened:
Upvotes: 1
Views: 116
Reputation: 28541
A shortcut that will save you time : CTRL + SHIFT + O
in Eclipse (will organize the imports of the current file in the editor). Try it and see what else needs to be fixed in your code.
A combo I like instead of doing a save (real fast to type when you're used to it):
CTRL + SHIFT + O
: organize importsCTRL + SHIFT + F
: format codeCTRL + SHIFT + S
: save all opened filesUpvotes: 0
Reputation: 10482
import android.widget.AdapterView.OnItemSelectedListener;
Please check above import.
Upvotes: 0
Reputation: 11093
Either delete the import android.widget.SpinnerAdapter
, or change your Classname to something like CustomAdapter
(and you'll see that the instantiated object will just remain an interface (which should be your concrete class), so change that as well)
Upvotes: 1
Reputation: 17278
Your code has a naming conflict with the standard Android interface SpinnerAdapter. To make sure your own class SpinnerAdapter
is used, make sure to prefix it with the full package name. Getting rid of the android.widget.SpinnerAdapter
import should work too.
To avoid any and all confusion, you might want to simply change the name of your own adapter.
Upvotes: 0
Reputation: 40203
Your code fails to compile simply because SpinnerAdapter
is an interface, and as you know, you can't instantiate an interface. You should use one of the classes that implement SpinnerAdapter
. You can find more information in the documentation. Hope this helps.
Upvotes: 0