Hallo 
Powered by Telkomsel BlackBerry®

-----Original Message-----
From: mike <[email protected]>
Sender: [email protected]
Date: Sun, 30 May 2010 05:57:59 
To: Android Developers<[email protected]>
Reply-To: [email protected]
Cc: <[email protected]>; <[email protected]>; <[email protected]>; 
<[email protected]>; <[email protected]>
Subject: [android-developers] Local Search Does not work

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]
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