Hi,

Initiallly thanks for your answer,

can we make a app to automatically update the database of contacts so that
recently added contacts will also be added,

if yes,
lease reply me how,
Thanks


Thanks,
Pendem Shiva Shankar,
Gtalk:pendem.shiva89,
msn:[email protected],
Mob:+91-9533024675.


On Wed, Jul 31, 2013 at 12:23 AM, Kristopher Micinski <
[email protected]> wrote:

> Why don't you read them into memory when the app starts and cache them
> somewhere?
>
> Kris
>
> On Tue, Jul 30, 2013 at 2:27 PM, shiva pendem <[email protected]>
> wrote:
> > HI everyone,
> >
> >
> > i am making an application to get the name of the contact no saved on the
> > mobile.
> >
> > i am using the following code
> >
> > private class CallStateListener extends PhoneStateListener {
> > private String displayContacts(String incomingNumber) {
> >     ContentResolver cr = ctx.getContentResolver();
> >        Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,
> >                null, null, null, null);
> >        if (cur.getCount() > 0) {
> >         while (cur.moveToNext()) {
> >         String id =
> > cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
> >         String name =
> >
> cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
> >         if (Integer.parseInt(cur.getString(
> >
> > cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) {
> >                     Cursor pCur = cr.query(
> >                     ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
> >                     null,
> >                     ContactsContract.CommonDataKinds.Phone.CONTACT_ID +"
> =
> > ?",
> >                     new String[]{id}, null);
> >                     while (pCur.moveToNext()) {
> >                     String phoneNo =
> >
> pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
> >                     if(phoneNo.length()>9&&incomingNumber.length()>9)
> >                     {
> >                     //
> > Log.v("Test",phoneNo.substring(phoneNo.length()-10,phoneNo.length())+"
> >
> "+incomingNumber.substring(incomingNumber.length()-10,incomingNumber.length()));
> >
> >
> if(phoneNo.substring(phoneNo.length()-10,phoneNo.length()).equals(incomingNumber.substring(incomingNumber.length()-10,incomingNumber.length())))
> >                     {
> >                     Toast.makeText(ctx, "Name: " + name + ", Phone No: "
> +
> > phoneNo, Toast.LENGTH_SHORT).show();
> >                     Log.v("Test","qualified   "+phoneNo+"   "+name);
> >                     pCur.close();
> >                     return ""+name;
> >                     }
> >                     }
> >                     }
> >              pCur.close();
> >          }
> >         }
> >        }
> >        return "";
> >    }
> > i am calling the displayContacts() method with the incoming call no as
> > argument
> > but its taking about 18 to 29 seconds to get the contact name, some
> times it
> > is taking more than 35 seconds,
> >
> > can any one suggest me the best way to get the contact names saved in the
> > mobile,
> > i need to get the contact name in the following manner,
> > i have a contact with name as service call and no as 9848012345
> > and if i get a call i should get the name in not more than 5 seconds .
> >
> > if there are any new mechanisms that are used to implement this mechanism
> > plese send me the links,
> >
> > Thanks
> > Shiva Shankar,
> >
> > --
> > --
> > 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 unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected].
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
> --
> --
> 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 a topic in the
> Google Groups "Android Developers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/android-developers/XiQX9YLoMZc/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to