我知道这可能已经被问到了,但我无法得到具体的答案。我有一个 json 字符串:
GraphObject{graphObjectClass=GraphPlace, state={"id":"268367713308665","category":"School","location":{"state":"","zip":"","longitude":32.631482614136,"latitude":0.24519375867929,"country":"Uganda","city":"Kampala","street":"PO BOX 28493"},"category_list":[{"id":"365182493518892","name":"School"}],"name":"Little Wonders Montessori"}}
GraphObject{graphObjectClass=GraphPlace, state={"id":"142442605900768","category":"Education","location":{"state":"","zip":"","longitude":32.606752647018,"latitude":0.28746491511647,"country":"Uganda","city":"Kampala","street":"Heritage\/ Kiwafu Stage, Wheeling Zone, Gaba Road, Kansanga"},"category_list":[{"id":"151676848220295","name":"Education"}],"name":"Wisdomgate Pre-School, Kansanga."}}
当我查询附近的地方时,我从 facebook 获得,我想提取纬度、经度、类别和名称。这就是我正在尝试的
public void onCompleted(List<GraphPlace> places, Response response) {
//Toast.makeText(getActivity(), (CharSequence) places.listIterator(), Toast.LENGTH_LONG).show();
ListIterator<GraphPlace> x = places.listIterator();
while(x.hasNext()){
String f = x.next().toString();
Toast.makeText(getActivity(), f, Toast.LENGTH_LONG).show();
mytext.setText(f);
try {
JSONObject json = new JSONObject(f);
JSONArray array = json.getJSONArray( "GraphPlace" );
Toast.makeText(getActivity(), array.length(), Toast.LENGTH_LONG).show();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
});
request.executeAsync();
但是,我似乎无法获得入口点,无论我尝试多少,我都无法得到任何东西提前感谢您的帮助。