1

I have tried using pyjnius to retrieve contact ,may be i have made some mistakes. can anyone help me to solve it

def build(self):
    try:
        PythonActivity=autoclass("org.renpy.android.PythonActivity")
        ContactsContract=autoclass("android.provider.ContactsContract")
        cr = PythonActivity.mActivity.getContentResolver()
        null = None # this will help to convert java examples into python ones :)
        cur = cr.query(ContactsContract.Contacts.CONTENT_URI,
                       null, null, null, null)
        CONTACTS_ID = '_id'
        if (cur.getCount() > 0):
            while (cur.moveToNext()):
                id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID)
                return Label(text=str(id).replace(' ', '\n'))
    except Exception as ex:
        return Label(text=str(ex).replace(' ', '\n'))
NILoy
  • 103
  • 1
  • 6
  • Relevant: [how-can-i-get-contact-name-with-his-her-number](https://stackoverflow.com/questions/6009852/how-can-i-get-contact-name-with-his-her-number) – stovfl Sep 25 '18 at 11:56
  • I do not want phone number according to name i want all names and phone numbers of the android device – NILoy Sep 25 '18 at 12:03

0 Answers0