Using spinneradapter
satya - Wednesday, February 02, 2011 4:40:03 PM
Some samplecode from google
satya - Wednesday, February 02, 2011 4:41:56 PM
Here is the spinner application entry point
satya - Wednesday, February 02, 2011 4:51:43 PM
android spinneradapter
android spinneradapter
satya - Wednesday, February 02, 2011 4:59:00 PM
ArrayAdapter SpinnerAdapter
ArrayAdapter SpinnerAdapter
satya - Wednesday, February 02, 2011 10:58:06 PM
SpinnerAdapter is an interface. Here is how to implement it
public class MyAdapter extends ArrayAdapter<String>
implements SpinnerAdapter
{
public MyAdapter(Context ctx)
{
super(ctx,
android.R.layout.simple_spinner_item,
new String[]{"one","two"});
this.setDropDownViewResource(
android.R.layout.simple_spinner_dropdown_item);
}
public View getDropDownView(
int position, View convertView, ViewGroup parent)
{
return super.getDropDownView(
position, convertView, parent);
}
}
satya - Wednesday, February 02, 2011 11:03:29 PM
Example of a spinner in layout
<Spinner android:id="@+id/spinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:prompt="Choose One" />
satya - Wednesday, February 02, 2011 11:06:43 PM
workign with spinner in java
Spinner spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<String> adapter =
new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1,
new string[]{"Dave","Satya",?Dylan?});
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);