I have class Person
class person{
int ID ;
sting FirstName ;
string Last Name ;
String Telephone ;
}
and I have ArrayList<person> ;
now I want to display simple list view containing just FirstName + "," + "LastName"
so I can use code like
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Select Color Mode");
ListView modeList = new ListView(this);
String[] stringArray = new String[] { "Bright Mode", "Normal Mode" };
ArrayAdapter<String> modeAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, stringArray);
modeList.setAdapter(modeAdapter);
builder.setView(modeList);
final Dialog dialog = builder.create();
dialog.show();
so how to cconvert the ArrayList to string[] that contains the format FirstName + "," + "LastName"
I can loop , but Is there any good way or simple way to do that , because I tried to use adapter but it failed to appear in the dialoge