Hi all 

-----Original Message-----
From: Dmitri Plotnikov <[email protected]>
Sender: [email protected]
Date: Sun, 30 May 2010 12:15:12 
To: <[email protected]>
Reply-To: [email protected]
Cc: <[email protected]>; <[email protected]>; 
<[email protected]>; <[email protected]>; <[email protected]>
Subject: Re: [android-developers] Local Search Does not work

The problem might be that you are looking for the exact case-sensitive
match.  You might want to consider LIKE or GLOB.  Also you might want to
escape the query to avoid sql injection.

Cheers,
Dmitri

On May 30, 2010 5:58 AM, "mike" <[email protected]> wrote:
> hi guys,
>
> i have implemented my own search for Contacts but every time it
> return's nothing from the searching criteria.
>
> if (getIntent().getAction().equals(Intent.ACTION_SEARCH)) {
> String query = getIntent().getStringExtra(SearchManager.QUERY);
> Cursor cursor = getContentResolver().query(Phones.CONTENT_URI,
> null, Phones.NAME + "='" + query.trim() + "'", null,
> Phones.NAME + " ASC");
> startManagingCursor(cursor);
> boolean b = cursor.moveToNext();
> String[] columns = new String[] { Phones.NAME, Phones.NUMBER };
> int[] names = new int[] { R.id.contactName, R.id.number };
> dispCont = new DisplayContacts(this, R.layout.contacts, cursor,
> columns, names);
> setListAdapter(dispCont);
> registerForContextMenu(getListView());
> }
>
> this is my manifest
>
> <activity android:name=".contatcs.Contacts">
> <intent-filter>
> <action android:name="android.intent.action.SEARCH" />
> <category android:name="android.intent.category.DEFAULT" />
> </intent-filter>
> <intent-filter>
> <action android:name="android.intent.action.SEARCH" />
> <category android:name="android.intent.category.DEFAULT" />
> </intent-filter>
> <meta-data android:name="android.app.searchable"
> android:resource="@xml/quicksearch" />
> </activity>
>
> the query String will contains a value but cursor.moveToNext() will
> always returns false.
>
> any idea about this??
>
> regards,
> Mike
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to