Attempt to invoke virtual method 'java.io.File android.content.Context.getCacheDir()' on a null object reference olley code example

Example: java.io.File android.content.Context.getCacheDir()

public class API extends Application {

    public static final String ServerURL = "http://<Use real server here>:63424";
    public static final String GET = ServerURL+"/api";
    public static final String POST = ServerURL+"/api";
    protected RequestQueue queue;

    private final API mInstance;

    private API() { }

    public API getInstance() {
        return mInstance;
    }

    @Override
    public void onCreate(){
        super.onCreate();
        mInstance = this;
        queue = Volley.newRequestQueue(this);
    }

Tags:

Java Example