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(" ","")); } }