I have ,in a fragment, a method call who open an AlertDialog when an user tap on an button, in that dialog I would like to show a Spinner with countries ( Spain, Italy, Fren
This may not help everyone, but I was having this issue trying to add a spinner to a PopupWindow.
I updated my compileSdkTarget from 23 to 25, and my support library version to 25.1.0, but it didn't help.
It turned out that changing the spinnerMode to "dialog" worked round the problem:
<Spinner
android:id="@+id/group_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:spinnerMode="dialog"
/>
It doesn't completely fix it of course if you really want a dropdown spinner.
I faced and win this problem!
In case if you are using AndriodAnnotations here the problem is that I filled the lists in the method onCreate()
.
I used to get View via findViewById(R.id...)
and worked with them.
Now, as it turned out during debugging, all Views is not created in onCreate()
yet!
The problem was solved when I found an annotation @AfterViews
in the docs, and the method under this annotation now fills all my actions and does initialization of fields.
So, anyway, check your code on NullPointerException caused by invoking empty view object.
There are several different causes of this problem. In my case (was trying to sign up to Parse), I got this error trying the app on a tablet.When I switched to an Android phone, I got the error message:
You must register this ParseObject subclass before instantiating it
So, In my App.java
class I did this:
public class App extends Application {
public void onCreate() {
super.onCreate();
Parse.enableLocalDatastore(this);
Parse.initialize(this, "PARSE APPLICATION ID", "PARSE CLIENT KEY");
}
}
and then in my manifest, I did this:
<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
...
That was it.Had nothing to do with Spinner
In my case I solved the problem just setting for all the modules in the project the same SDKCompileVersion. Here it is my complete answer in a similar question
Cheers
Could not find class 'android.widget.ThemedSpinnerAdapter' [Android Studio]