I used the instructions given Here: http://developer.android.com/guide/topics/ui/dialogs.html#AddingAList to create a List in a dialog.
The problem is I don't seem to find out a way to wrap long text inside the options. [Please see the image below]
Please tell me how to do the text wrapping. :(
I am using the following code:
items= getArrayFromJson(source+"getdetails.php?brand="+bName+"&car="+cName);
builder = new AlertDialog.Builder(this);
builder.setTitle("Choose Model");
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
if(items[item].equals("No Options Available")){
dismissDialog(2);
}
else{
model.setText(items[item]);
mName= items[item].toString();
location.setEnabled(true);
dismissDialog(2);
}
}
});
alert = builder.create();
return alert;
Any help/direction is highly appreciated :)
At first I would create a list layout... something like:
list_layout
Then a simple TextView like:
single_item_layout
and a simple main layout:
main
lastly a simple main Activity:
and that's all.
I tried to make that as simple as possible, you can google for ideas to make your list a bit attractive, like here.