0

I'am working with ion for download image in my custom list, and it's work perfect! Now I want to use this lib for json. So I tried it, but it's not work.

Anybody know why this sample code return NULL? Or how do it simple?

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;

import com.google.gson.JsonObject;
import com.koushikdutta.async.future.FutureCallback;
import com.koushikdutta.ion.Ion;


public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Ion.with(this)
                .load("http://api.androidhive.info/volley/person_object.json")
                .asJsonObject()
                .setCallback(new FutureCallback<JsonObject>() {
                    @Override
                    public void onCompleted(Exception e, JsonObject result) {
                        // do stuff with the result or error
                        System.out.println(result);
                    }
                });
    }

}

1 Answers1

0

Check the exception.

derp derp 20 char limit.

koush
  • 2,972
  • 28
  • 31