我尝试使用pyjnius检索联系人,可能是我犯了一些错误。谁能帮我解决这个问题
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'))