private
class
phpDown
extends
AsyncTask<String, Integer,String>{
서버에 값을 넘기는 부분은 생략했습니다.
protected
void
onPostExecute(String str){
try
{
String name, gender, height, weight;
JSONObject root =
new
JSONObject(str);
JSONArray ja = root.getJSONArray(
"results"
);
for
(
int
i=
0
; i<ja.length(); i++){
JSONObject jo = ja.getJSONObject(i);
name = jo.getString(
"Name"
);
gender = jo.getString(
"Gender"
);
height = jo.getString(
"Height"
);
weight = jo.getString(
"Weight"
);
infoItem.add(
new
InfoItem(name,gender,height,weight));
}
}
catch
(JSONException e){
e.printStackTrace();
}
txtView.setText(
"Name :"
+infoItem.get(
0
).getData(
0
));
}
}