从JSON对象分离数据(Android)

时间:2013-04-07 21:36:17

标签: android json

我正在尝试将3个字段的数据与JSON对象分开并将其设置为TextView,但它将数据显示为:

      {"Phone":"123"
      ,"Name":"temp"
      ,"Status":"true"}

我只想在textView中使用表123中的值,temp,true,那么如何将这3个字段分开?

以下是代码:

 JSONObject jsonObj = new JSONObject(params);
            user = new Users();
            user.setName(jsonObj.getString("Name"));
            user.setPhone(jsonObj.getString("Phone"));
            user.setStatus(jsonObj.getBoolean("Status"));
            tv.setText(jsonObj.toString());

User是带有get的类,设置了Name,Phone& amp;的方法。状态。

1 个答案:

答案 0 :(得分:0)

完成!通过使用java.lang.Stringbuilder,