Thursday 12 September 2013

OnSelect of Spinner show a Dialog with listview Android

OnSelect of Spinner show a Dialog with listview Android

I have a Spinner in which i am showing a list .Now i want to show that
list in a custom dialog that has listview on selection of list view item
.Spinner value will be the value that is selected from the listview item .
This is my Spinner
<Spinner
android:id="@+id/Tittle"
android:layout_width="290dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:visibility="gone"
android:layout_height="wrap_content"/>
This is how i am setting the value in the spinner
public void setTittle() {
String[] tittlearray = { "Mr.", "Mrs.", "Ms" };
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, tittlearray);
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
tittleSpinner.setAdapter(dataAdapter);
}
This is my ListView
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/listview"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</ListView>
</RelativeLayout>
Now i want this list in the Custom Dialog.Please help me to get this .

No comments:

Post a Comment