好的,伙计们,我在一行代码中遇到语法错误,我似乎无法弄清楚原因。我只是在很短的时间内修补了 android,但我很确定我已经很好地遵循了给定的示例,但是我一生都无法摆脱这个错误。该代码用于联系人选择器,因此我可以使用人员号码填充编辑文本,然后使用 mms 意图向该号码发送图片。我已经标记了出现错误的位置,并且在解决之前无法完全完成我正在尝试的操作。(只显示有问题的部分)
break;
case R.id.contact:
Intent k = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(k, 1);
@Overide
public void onActivityResult (int reqCode, int resultCode, Intent data) { //<Getting the syntax errors here
super.onActivityResult(reqCode, resultCode, data);
{
if (resultCode == Activity.RESULT_OK) {
Uri contactData = data.getData();
Cursor cur = managedQuery(contactData, null, null, null, null);
ContentResolver contect_resolver = getContentResolver();
if (cur.moveToFirst()) {
String id = cur.getString(cur.getColumnIndexOrThrow(ContactsContract.Contacts._ID));
String name = "";
String no = "";
Cursor phoneCur = contect_resolver.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID = " = ?", new String [] { id }, null);
if (phoneCur.moveToFirst()) { name = phoneCur.getString(phoneCur.getColumnIndex (ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
no = phoneCur.getString(phoneCur.getColumnIndex (ContactsContract.CommonDataKinds.Phone.NUMBER));
}
}
}
}
}
break;
Now the errors it is throwing are:
- Syntax error on token "(", ; expected
- Syntax error on token(s), misplaced construct(s)
- Syntax error on token ")", ; expected
- Syntax error on token ",", ; expected
- Syntax error on token ")", ; expected
- Syntax error on token "(", ; expected
都在那一行。我完全一无所知。