使用Ion库将json数据设置为TextView

时间:2016-10-12 10:29:50

标签: java android json ion

我正在尝试寻找一种方法将json中每个对象的数据设置为不同的TextView,但我不知道如何在{{1}中使用result的{​​{1}} }} 方法。下面是我想要检索的JSON示例。

Json

这是离子法

onCompleted

这是我的全班。

[
  {
    "progname": "BACHELOR OF BUSINESS ADMINISTRATION",
    "gradSystem": "NCHE 2015",
    "entryno": "00458",
    "regno": "BABA/09/W/J0434",
    "firstname": "CHARLES",
    "dob": "/Date(220136400000)/",
    "gender": "MALE",
    "nationality": "UGANDAN",
    "religion": "-",
    "entrymethod": "DIRECT",
    "progid": "01307",
    "studPhone": "256772372062",
    "email": "-@-",
    "entryyear": 2009,
    "studsesion": "DAY",
    "home_dist": "-",
    "intake": "JANUARY",
    "gradSystemID": 1,
    "othername": "MUTABAZI",
    "duration": 3,
    "photofile": "mutabazi charles.png"
  }
]

如果我尝试运行该项目,则这是logcat中的错误

Ion.with(StudentsProfile.this)
                .load(url)
                .asJsonObject()
                .setCallback(new FutureCallback<JsonObject>() {
                    @Override
                    public void onCompleted(Exception e, JsonObject result) {
                        String reg =        result.toString();
                        reg_no.setText(reg);


                    }
                });

0 个答案:

没有答案