请教,在eclipse中为什么faces.getJSONObject();里面只能传入String类型的参数 无法传入int型的参数??

这个问题我不太懂,求解答???

这个问题我不太懂,求解答???
2015-11-18
private void prepareRsBitmap(JSONObject rs) {
// TODO Auto-generated method stub
try {
JSONArray faces = rs.getJSONArray("face");
/**
* 找到多少张脸,并在mTip中显示出来
*/
int faceCount = faces.length();
mTipTextView.setText("find" + faceCount +"faces");
/**
* 循环得到每一张脸,
*/
for(int i = 0 ;i < faceCount; i++){
/**
* getJSONObject()只能传入String类型的参数 ,无法传入int类型的参数
*/
JSONObject face = faces.getJSONObject(i);
/**
* 拿到position属性
*/
JSONObject posObject = face.getJSONObject("position");
double x = posObject.getJSONObject("center").getDouble("x");
double y = posObject.getJSONObject("center").getDouble("y");
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}我错了 回头百度了JSAON才发现得到脸的数目需要用到JSONArray()..而解析脸的内部属性的时候需要用到JSONObject()...................
举报