ContentResolver query Grammar

by Ivy » Fri, 17 Jul 2009 11:36:12 GMT


Sponsored Links
 String phonenumberString=PhontUliti.formatPhoneNumber(number);
            String[] contactsProjection=new String[]
{People.NAME,People._ID,People.NUMBER,Contacts.Phones.TYPE};
            Cursor contactsCursor=context.getContentResolver().query
(People.CONTENT_URI,
                           contactsProjection, People.NUMBER +" = " 
+phonenumberString,
                           null, People.DEFAULT_SORT_ORDER);

Why the contactsCursor is null?
The number is in   the contacts.
Is there any mistakks in the query?
--~--~---------~--~----~------------~-------~--~----~



ContentResolver query Grammar

by Ivy » Fri, 17 Jul 2009 11:59:50 GMT


 The PhontUliti.formatPhoneNumber(String number) replace "" within
"-".And if i change like this  the cursor is also null
 String[] contactsProjection=new String[]
{People.NAME,People._ID,People.NUMBER,Contacts.Phones.TYPE};
            Cursor contactsCursor=context.getContentResolver().query
(People.CONTENT_URI,
                           contactsProjection, PhontUliti.formatPhoneNumber( 
People.NUMBER )
+" =?",
                           new String[]{"15827381718"}, 
People.DEFAULT_SORT_ORDER);




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


Sponsored Links


Other Threads

1. encode html with inputstream

Hi,

i am reading a text from the net and like to have it right encoded
(german umlaute)

-----------
                        conn = new URL(mediaUrl).openConnection();
                        InputStream is = conn.getInputStream();
                        ByteArrayBuffer baf = new ByteArrayBuffer(50);
                        InputStreamReader isr = new 
InputStreamReader(is,"windows-1252");

                        int current = 0;
                        while ((current = isr.read()) != -1)
                        {
                                baf.append((byte) current);
                        }
                        Log.i(TAG, " *------ Load Data done -----*: ");

                        /* Convert the Bytes read to a String. */
                        html = new String(baf.toByteArray());
-------------

but still in my final "html" its not encoded and the german umlaute
are wrong.

Who can i read a stream and get it right encoded?

thanks
chris

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

2. Accessing CallLog beyond Activity

Hi!

I want to get informed in a service about outgoing calls! As far as i
have seen its only possible with the CallLog. I found an example like
this:

          Cursor c = getContentResolver().query(
                    android.provider.CallLog.Calls.CONTENT_URI,
                    null, null, null,
                    android.provider.CallLog.Calls.DATE + " DESC");
          startManagingCursor(c);

The problem is, that i cannot invoke getContentResolver because the
class i want to use doesnt provide it. I found out that you need a
class that excents Activity to use this construct. Is it also possible
in another way?

Thanks
--~--~---------~--~----~------------~-------~--~----~

3. Users having to buy apps twice

4. Android web-pad

5. Launch Application

6. image transfer howto

7. Yet another layout question.