-1

I am creating a costum ListView

enter image description here

In this ListView I have the a list.xml with an item which has an image and three text fields.

enter image description here

Now to my problem :P

How can I add this custom ListView ITEM to my ListView (after a Button from another activity is clicked) and save it somewhere like in SQL...

Yuchen
  • 30,852
  • 26
  • 164
  • 234
Tester
  • 139
  • 2
  • 8
  • Possible duplicate of [Dynamically add elements to a listView Android](https://stackoverflow.com/questions/4540754/dynamically-add-elements-to-a-listview-android) – Yuchen Jun 25 '17 at 12:33

2 Answers2

0

Don't use ListView. Use RecyclerView instead. https://developer.android.com/training/material/lists-cards.html#RecyclerView

You need to create adapter where you point proper XML file for an item

0

1. First, create a custom layout XML for your list row item(Image and 3 TextViews).

2. Create a custom adapter class to populate your ArrayList<OBJECT> on custom list row XML.

Here are some good tutorials:

  1. Android Custom ListView with Image and Text
  2. Android Custom ListView with Image and Text using Volley
  3. Android Working with Recycler View

FYI, You can use RecyclerView instead of ListView. Android RecyclerView is more advanced version of ListView with improved performance and other benefits.

Hope this will help~

Community
  • 1
  • 1
Ferdous Ahamed
  • 21,438
  • 5
  • 52
  • 61