写道
private String getContactsId(Object parameters) {
String sId = parameters.toString();
int id = Integer.parseInt(sId);
try {
Uri myPerson = ContentUris.withAppendedId(People.CONTENT_URI, id);
cr = AndroidBaseActivity.self.getContentResolver();
Cursor cur = AndroidBaseActivity.self.managedQuery(myPerson, null,
null, null, null);
String peopleId = "";
if (cur != null) {
cur.moveToFirst();
int idColumn = cur.getColumnIndex(Contacts.People._ID);
int peopleNameIndex = cur
.getColumnIndex(Contacts.People.DISPLAY_NAME);
peopleId = cur.getString(idColumn);
String peopleName = cur.getString(peopleNameIndex);
// String phoneNumber = cur.getString(mobileNumberIndex);
if (peopleId != null) {
jsonPeopleNumbers.put("id", peopleId);
jsonPeopleNumbers.put("name", peopleName);
// 多个号码的获取,我用的是静态方法,例外实现
queryContactPhones(AndroidBaseActivity.self, id);
// 多个邮箱的获取。我用的是静态方法,例外实现
queryContactEmailAddress(AndroidBaseActivity.self, peopleId);
// queryContactPostalAddr(AndroidBaseActivity.self,
// peopleId);
// queryContactMessenger(AndroidBaseActivity.self,
// peopleId);
cur.close();
}
}
} catch (Exception e) {
Log.i(TAG, e.toString());
} finally {
peopleJSON.put(jsonPeopleNumbers);
}
return peopleJSON.toString();
}
分享到:
相关推荐
org.json.JSONObject引用依赖包 org.json.JSONObject引用依赖包 org.json.JSONObject引用依赖包 org.json.JSONObject引用依赖包
org.json.JSONObject的6个jar包 commons-beanutils;commons-collections;commons-lang;commons-logging;ezmorph;json-lib
解决net.sf.json.JSONObject 解决net.sf.json.JSONObject
net.sf.json.JSONObject需要的jar包 -- net.sf.json.JSONObject需要的jar包
net.sf.json.JSONObject相关依赖架包,导入项目后,JSONObject.fromObject()方法就可以使用了
net.sf.json.JSONObject相关jar包
net.sf.json.JSONObject所需要的jar包 commons-beanutils-1.9.3.jar commons-collections-3.2.2 commons-lang-2.6 commons-logging-1.2 ezmorph-1.0.6 json-lib-2.4-jdk15
com.alibaba.fastjson.JSONObject(JAR包)下载 ,jar包含了json的转换和使用
java开发中需要jsonObject,jsonArray需要用到6个jar包,net.sf.json.JSONObject commons-beanutils-1.7.0.jar commons-collections-3.1.jar commons-lang-2.5.jar commons-logging.jar ezmorph-1.0.3.jar json-lib-...
Java中 com.google.gson.JsonObject ,com.google.gson.JsonArray 所需JAR包
com.alibaba.fastjson.JSONObject(JAR包) JSONObject(JAR包)
org.json.JSONObect的一个jar包org.json.JSONObect的一个jar包
Java的net.sf.json.JSONObject , 发现Maven仓库找不到, 特意上传供大家分享
JSONObject JSONArray JavaBean和json数据的转换等,都可以使用。
开源最新的json 库文件。json-lib-2.4-jdk15, fastjson-1.2.2
网上都说fastjson很方便,很多教程说如何使用但是却没有jar包,这个版本是2020年目前最新的fastjson-1.2.73
NULL 博文链接:https://suko.iteye.com/blog/2187798
NULL 博文链接:https://bijian1013.iteye.com/blog/2310861