mercredi 2 avril 2014

koush/ion getting json in in textview


Vote count:

0




I'm trying to understand Koushi-ion's code so that i can get json data from website and input it into a listview. for now i am testing it with just a textview.



@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.testview);
test = (TextView)findViewById(R.id.testview1);

Ion.with(getApplication(), "mywebsite")
.asJsonObject()
.setCallback(new FutureCallback<JsonObject>() {
@Override
public void onCompleted(Exception e, JsonObject result) {
// do stuff with the result or error
inputTest = result.getAsString();
test.setText(inputTest);
}


i get the logcat error :unsupportedoperationException: JsonObject at com.google.Gson.JsonElement.getAsString(JsonElement java:191);


Is it not that simple with Ion?



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire