Question

I have some code like this:

public class ModelLoader<T extends Model> {
    public ArrayList<T> fromJson(JSONArray jsonObjects) {
         // blah blah blah
    }

    public void getAll(final OnRequestCompleted<T> callback) {
        client.get(endpoint, null, new JsonHttpResponseHandler() {
            @Override
            public void onSuccess(JSONArray resp) {
                // I want to call the fromJson method here
            }

        });
    }
}

I have seen in various places that I can use OuterClass.this, which in this case would be ModelLoader<T>.this but that gives me syntax error.

How can I do this?

Was it helpful?

Solution

You should use ModelLoader.this instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top