loop for Cursor1.moveToPosition() in android

Posted by Edward Sullen on Stack Overflow See other posts from Stack Overflow or by Edward Sullen
Published on 2012-10-13T15:32:51Z Indexed on 2012/10/13 15:37 UTC
Read the original article Hit count: 157

Filed under:

I want to get data in the first column of all row from my database and convert to String[] ...

List<String> item1 = new ArrayList<String>();
// c is a cursor which pointed from a database
for(int i=0;i<=nombre_row;i++)
    {
        c.moveToPosition(i);
        item1.add(c.getString(0));
    }
String[] strarray = new String[item1.size()];
item1.toArray(strarray );

I've tried to command step by step, and found that the problem is in the Loop for.... Please help... thanks in advance for all answer.

© Stack Overflow or respective owner

Related posts about android