Hi there. I have a JSON
that parsed in a ListView
.
My JSON Objects are like this:
Object[
{
category{},
create_time: "2014-04-18T22:47:04",
file_url: "FILE URL",
id: 1,
Type: video,
video_dow_cnt: 120
},
{
category{},
create_time: "2014-04-18T22:47:04",
file_url: "FILE URL",
id: 1,
Type: Sound,
sound_like: 11
},
{
category{},
create_time: "2014-04-18T22:47:04",
file_url: "FILE URL",
id: 1,
Type: Image,
Image_Type: jpg
},
{
category{},
create_time: "2014-04-18T22:47:04",
file_url: "FILE URL",
id: 1,
Type: Text,
description: DESCRIPTION,
text_like: 25
},
]
As you can see, i have more than one type object. for each type, I created a xml file like this:
Sound_Row.xml -> for Sound
video_Row.xml -> foe Video
photo_Row.xml -. for Images
text_Row.xml -> for Text
I know how to create custom adapter by extending the base adapter, But my issue is how to using of "Type" field in getViewItemType()
to determine which of the layouts to use for the ListView.