This is my Code :
private ArrayList<Receipt> receipts = new ArrayList<Receipt>();
ArrayAdapter<Receipt> adapter;
// In onCreate
adapter=new ArrayAdapter<Receipt>(this,android.R.layout.simple_list_item_1, receipts);
listView.setAdapter(adapter);
//---------------------------------
private void addReceiptInListView(Receipt receipt)
{
adapter.notifyDataSetChanged();
}
Now the receipts contain following things in it
1- Title,
2- Comments
3- Reference No.
4- Image
I want to show all these things in my added listView. How can i show that.
Thanks in Advance 🙂
ArrayAdapter, by default, will show only a list ofStringso it can’t show your fullReceipt. To show the extra information of yourReceiptobject will have to implement your ownArrayAdapterand provide the custom layout for the row and then manually bind theReceiptdata with the views in thegetView()method of theArrayAdapter.Here is a link with a tutorial about implementing your own custom adapter.