Skip to content
Advertisement

data from sqlite into ArrayList

i am using code this blog to have a draggable list. This tutorial is using a custom DragNDropAdapter that takes the content as an ArrayList.

In my listActivity i query a table with returned column name.It has 11 values inserted. i tried to convert it to ArrayList from String[] with many ways such as :

JavaScript

or

JavaScript

what i get is a list with just the name of the column, name. do you have any ideas

Advertisement

Answer

JavaScript

Because your string array has only one value which is KEY_NAME.

What you need to do is,

Get values from Cursor using loop and populate it String[] above.

JavaScript

Note: I haven’t validated this in IDE, there may be syntax errors.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement