Adding rows into Cursor manually

前端 未结 4 556
無奈伤痛
無奈伤痛 2020-12-03 13:47

I have an array of phone numbers and I want to get the corresponding contact names from the contacts database.

In the array of phone numbers, I also have some number

4条回答
  •  佛祖请我去吃肉
    2020-12-03 14:16

    Unfortunately, As far as I know, there is no way that you can manually add data to the cursor. You need to handle this in a different way.

    The only way that I can think of in which you can do this is

    • Make a structure with the data fields you need.
    • Make a Arraylist and fill the objects of your structure with the data from the cursors and add them to the list.
    • Now add your missing number information manually and add them to the list.
    • Pass this list to your adapter, in case u r passing ure cursor to an adapter now. Of course you would have to change your cursoradapter implementation to an arrayadapter.

提交回复
热议问题