ArrayAdapter

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

ArrayAdapter

Postby gerry013 » Sun Feb 07, 2010 12:06 pm

Hi,

I'm using simple_list_item_1 to display the data.

Now I would like to use activity_list_item layout to show the list of items with an icon on each row.

I have this code:

int layoutID = android.R.layout.activity_list_item;
aa = new ArrayAdapter<MyString>(this, layoutID , my_strings);
my_stringsListView.setAdapter(aa);

MyStrings class contain the toString with the data I would like to use with the code:

public String toString() {
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
String dateString = sdf.format(date);
return my_image_id + " \t"+ dateString + " \t" + details;
}

How I must pass the icon using the toString ?
I tryed adding:
return R.drawable.icon1 + " \t"+ dateString + " \t" + details;
But it dosen't work

Many thanks!
gerry013
Freshman
Freshman
 
Posts: 3
Joined: Fri Aug 28, 2009 2:35 pm

Top

Postby Bear » Mon Feb 08, 2010 5:19 pm

You should convert integer value of ID to string
Bear
Junior Developer
Junior Developer
 
Posts: 15
Joined: Fri Jan 22, 2010 3:50 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 6 guests