Cant Resolve Constructor Arrayadapter
Can't use ArrayAdapter in a custom dialog. This is the error I am getting
Solution 1:
You're getting that error because the ArrayAdapter
constructor requires the first argument to be a Context
object. Since you're calling the constructor from inside an OnClickListener
, this
refers to the listener, not your activity (i.e. not a Context
).
You can qualify the this
keyword with the name of your outer class. Assuming that code is written inside of MainActivity
, you could write MainActivity.this
instead.
Post a Comment for "Cant Resolve Constructor Arrayadapter"