After trying for a long time, I found the solution. I created a separate class to store the data values for each individual row and created an array of objects of the same.
Here is the sample code:
import android.app.Activity;
import android.widget.ArrayAdapter;
class ListItem
{
public String textview1;
public String textview2;
public String textview3;
public int imageId;
public ListItem(String t1, String t2, String t3, int imageId)
{
this.textview1 = t1;
this.textview2 = t2;
this.textview3 = t3;
this.imageId = imageId;
}
}
public class CustomList extends ArrayAdapter<Object>
{
private Activity context;
private ListItem listItem[];
public CustomList(Activity context, ListItem li[])
{
super(context, R.layout.rowlayout, li);
}
}