Using listview in android

前端 未结 7 1952
你的背包
你的背包 2020-12-21 18:30

I am making an android application that needs to use a ListView. I want to add a menubutton that says \"Add to list\" and once the user presses that menubutton,

相关标签:
7条回答
  • 2020-12-21 18:56
    1. You have to create a layout containing a listView.

    2. You have to create an xml lyout corresponding to one row of your list view.

    3. You have to create an adapter which will populate data to insert in your listView

    4. You have to create an onClickListener on your button to add data in your list

    5. If you are using an ArrayAdapter or a CursorAdapter, add the new item you created to the list or the cursor used by your adapter and (notifyDataSetChanged() is automatically called), so your adapter will update the listview

    Source : http://developer.android.com/resources/tutorials/views/hello-listview.html

    Previous topic on it : Dynamic ListView in Android app

    0 讨论(0)
提交回复
热议问题