Reputation: 31
here are the codes
dChooser= (Spinner) findViewById(R.id.spinner1);
adapter = new ArrayAdapter<CharSequence>(this,R.array.d_choices);
dChooser.setAdapter(adapter);
and here is the xml part i dont understand what im doing wrong
<Spinner
android:id="@+id/spinner1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/time2"
android:layout_marginTop="24dp"
android:spinnerMode="dropdown"
android:background="@android:color/darker_gray" />
Upvotes: 0
Views: 41
Reputation: 1239
Your Adapter seems wrong use something like this
dChooser= (Spinner) findViewById(R.id.spinner1);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.d_choices, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
dChooser.setAdapter(adapter);
Upvotes: 1