Android Address Book Search

by mike » Wed, 02 Jun 2010 01:15:14 GMT


Sponsored Links
 hi guys,

i have developed a application which loads all the contacts in the
native address book.
since i have many contacts i created a search.

my address book contains contacts like this.

Alan
Bill

and then again

Alex
Cooper
Dillon

1. even in the native address book it's the same. may i know the
reason for that. (All my contacts are in phone book)

2. i using phones.CONTENT_URI to load all the contacts. that's how i
want to do it

and assume that i have search for Alan or Bill search query returns
nothing

but if i search foe Alex,Cooper or Dillon it will return the correct
result

this is my query

        private Cursor searchItems(String query) {
                Cursor cur = getContentResolver().query(Phones.CONTENT_URI , 
null,
                                Phones.NAME + "='" + query.trim() + "'", null, 
null);
                startManagingCursor(cur);
                int x = cur.getCount();
                if (cur == null || x == 0) {
                        // alert("Address Book", "Empty Address Book");
                }
                if (cur.moveToNext()) {
                        do {
                                Log.d("CURSOR_SSSS", Integer.toString(x));
                        } while (cur.moveToNext());
                }
                columns = new String[] { Phones.NAME, Phones.NUMBER };
                names = new int[] { R.id.contactName, R.id.number };
                return cur;
        }

could somebody help me out??

regards,
Mike

--



Other Threads

1. trouble when I try to import native android's cropimage class

Hello,

  I saw in a previous post on this group that cropimage activity used
in the camera app was not available for using in developper's apps.
One of the best way to use it was to import directly the code from
android's apps source code. That's what I did.

  I'm facing two problems with com.android.camera.CropImage  :

  1) there is references to a "mContext" object  (line 183, 220)

     CropImage cropImage = (CropImage)mContext; (183)
     ((CropImage)mContext).mWaitingToPick = false; (220)

   Eclipse shows en error on mContext : it is not declared in the
class, nor in the superclass com.android.camera.ImageViewTouchBase

  2) idem for variables mLeft, mRight, mTop, mBottom lines 267+ they
are not declared in the class, nor in the superclass :

        private void ensureVisible(HighlightView hv) {
            Rect r = hv.mDrawRect;

            int panDeltaX1 = Math.max(0, mLeft - r.left);
            int panDeltaX2 = Math.min(0, mRight - r.right);

            int panDeltaY1 = Math.max(0, mTop - r.top);
            int panDeltaY2 = Math.min(0, mBottom - r.bottom);

            int panDeltaX = panDeltaX1 != 0 ? panDeltaX1 : panDeltaX2;
            int panDeltaY = panDeltaY1 != 0 ? panDeltaY1 : panDeltaY2;

            if (panDeltaX != 0 || panDeltaY != 0)
                panBy(panDeltaX, panDeltaY);
        }

I can't figure where theses objects are/ should be declared...

Thanks by advance for your help !

--~--~---------~--~----~------------~-------~--~----~

2. other

please....
stop the email from android group

--~--~---------~--~----~------------~-------~--~----~

3. WARN/dalvikvm(1151): Shared lib '/system/lib/libwebcore.so' already opened by CL 0x0; can't open in 0x437571d0

4. Exception - can anyone make sense of this?

5. Android legacy bootloader -nandwrite and usbloader concept

6. this.getApplication() returns NULL pointer

7. Confusion about necessity to override onConfigurationChanged()