I have a little problem with a spinner.
I create a Spinner the user click a Button. The Spinner is shown as it should be, but
Solved the problem by adding a Spinner in my xml with height and width set to zero.
why do you have spinner = new Spinner(this) in the set-up ?
surely you already have a Spinner in the XML of your layout, then you simply do spinner = (Spinner) findViewById(R.id.WHATEVER_THE_ID_IS_IN_THE_XML); so you don't need a new
P.S. this is how I define a Spinner in an XML layout
<Spinner
android:id="@+id/SPINNER_ID"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="center_horizontal" />
This looks enough like the turorial, so refer back to that. See below:
I don't see this, but does the main class implement OnItemSelectedListener? Also, You'll want to instantiate the Spinner inside the onCreate() within the main class body.
This line needs to be within the onCreate();
spinner.setOnItemSelectedListener(new MyOnItemSelectedListener());