Before calling the function getColumnData(), you should be calling
startManagingCursor(), so that the cursor is initialized.

That should solve your problem,

Dexter.

On Sep 11, 9:14 am, "wahib.t...@gmail.com" <wahib.t...@gmail.com>
wrote:
> I am a newbie to android programming. I want to search the name of
> contact member by taking phonenumber from the user. I dont know whats
> the issue and when run it just displays error ..
> "Application has stopped unexpectedly !". My code is like this ...
>
> Uri myperson = Uri.withAppendedPath(People.CONTENT_URI, numtext.getText
> ().toString()); //numtext is the textbox object
>
> Cursor managedCursor = managedQuery(contacts, projection, null, null,
> People.NAME + "ASC");
> getColumnData(managedCursor);
>
> ///////
> String[] projection = new String[] {People.NAME, People._ID};
>
>     private void getColumnData(Cursor cur) {
>         if(cur.moveToFirst())
>         {
>                 String name;
>                 String id;
>                 int nameColumn = cur.getColumnIndex(People.NAME);
>                 int ideColumn = cur.getColumnIndex(People._ID);
>
>                 do
>                 {
>                         name = cur.getString(nameColumn);
>                         id = cur.getString(idColumn);
>                         Toast.makeText(searchbynum.this, name, 
> Toast.LENGTH_LONG).show
> ();
>                 }
>                 while(cur.moveToNext());
>
>         }
>
>     }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to