java - Get list of all names in content provider -


i'm using "calls.content_uri" content provider. retrived column names, let's say, names column name "name" in content provider.

i have code below:

uri = calls.content_uri;      string[] projection = {"name"};     string selection = null;     string[] selectionargs = null;     string sort = null;       resolver = getcontentresolver();      cursor = resolver.query(uri, projection, selection, selectionargs, sort);     log.i("tutorial", "counts :"+cursor.getcount());          string s;     cursor.movetofirst();      for(int x=0; x<cursor.getcount(); x++){          s = cursor.getstring(x);         log.i("tutorial", ""+s);          //cursor.movetonext();       } 

but retrives 1 name. have list of names saved in phone like:

john peter mark suzy . . x

but got 1 name like:

peter. hope i've been clear enough.

what's problem? in advance.

i think you

        arraylist<string> namelist = new arraylist<string>();     string[] projection = {"name"};     string selection = null;     string[] selectionargs = null;     string sort = null;     resolver = getcontentresolver();     cursor = resolver.query(uri, projection, selection, selectionargs, sort);     log.i("tutorial", "counts :"+cursor.getcount());         string s;     if(cursor.movetofirst()) {         {             namelist.add(cursor.getstring(0));             //your code             //s = cursor.getstring(x);             log.i("tutorial", ""+cursor.getstring(0));         }while(cursor.movetonext());     } 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -