我想拆分通过服务器收到的响应,以便我可以取值,并在文本上设置......但我不能取值......
响应:{"status":"no","requestCount":"0","estelamCount":"0"}
String[] split_model = response.split(",");
// Log.i("split_model",split_model);
Log.i("phoneName", split_model[0]);
log == > I/phoneName: {"status":"no"
最佳答案
String status ="";
JSONObject jsonObject = new JSONObject(response); //convert to json
if (jsonObject.has("status")){ //check if has the key
status = jsonObject.getString("status"); // get the value
}else{
}
Log.d("TAG", status); // do sth with the value
//Log => status
关于java - 如何使用正则表达式通过服务器拆分响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55465396/