bsh for android : 读通讯录

beanshell :  contacts.bsh

source("/sdcard/com.googlecode.bshforandroid/extras/bsh/android.bsh");
a = Android();
//a.call("viewContacts");

import org.json.*;

String utf8(String str){ return new String(str.getBytes("ISO8859_1"),"UTF-8");}

ids = a.call("contactsGetIds").get("result");
print(ids);
for (int i=0; i<ids.length(); i++){
    str = Integer.toString(ids.getInt(i));
    print(str);
    uri = "content://contacts/people/"+str+"/phones";
    res = a.call("queryContent",uri).get("result");
    // JSONArray res
    for (int i=0; i<res.length(); i++){
        p = res.getJSONObject(i); 
        print(utf8(p.getString("name"))+ p.getString("number").replace(" ",""));
    }
}



bsh for android : 读通讯录,布布扣,bubuko.com

bsh for android : 读通讯录

上一篇:Android App性能优化笔记之一:性能优化是什么及为什么?


下一篇:Android Canvas练习(7)绘制欧冠八强防守&控制率数据对比图