How Can I Create A Spinner Within A Fragment?
I'm trying to create a spinner in a fragment but while making the spinner dialog it fails to recognize the fragment java class using '.this'. I'm not sure what I should be doing in
Solution 1:
Replace Add.this
with getActivity()
.
It's hard to say for sure exactly what the problem is (since I don't know how SpinnerDialog
is implemented), but chances are very good that the constructor's first argument is a Context
. Fragment
s do not implement Context
, but Activity
s do. So instead of passing in your Fragment
instance, pass in its containing Activity
.
Post a Comment for "How Can I Create A Spinner Within A Fragment?"