I wrote a simple java function in Android Studio that sticks together a contact list into a string. Data is stored in xml. The function itself works fine. But when I try to call it in Qt via QAndroidJniObject , it gives errors. If you remove all the code from the function and leave one return , then the value will be transferred ... Please help to extend this line in C ++
public String getcontactlist() { ActivityCompat.requestPermissions(this, new String[ {Manifest.permission.READ_CONTACTS}, 1); //Запрос прав на получение контактов String fetch = "<root>"; //Создание строки и корневого элемента Cursor phones = getContentResolver().query( ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null); //Получаю телефоны while (phones.moveToNext()) { String name = phones.getString(phones.getColumnIndex( ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)); String phoneNumber = phones.getString(phones.getColumnIndex( ContactsContract.CommonDataKinds.Phone.NUMBER)); fetch += "<item><name>" + name + "</name><number>" + phoneNumber + "</number></item>";//В цикле приписываю к строке } fetch += "</root>"; добавляю закрывающий тег return fetch; //Возвращаю значение } Besides the function itself, I send the source of the project to Qt. Please help get the contact list https://drive.google.com/open?id=0B434-oBPl5BmTV9vbFNHa0xGamc
The call is made through the C ++ slot of the BackEnd class. The java function itself is located in android / src / com / example / contacts / fetch / in the FetchClass.java file and has the header getContacts