this question is more design related. Am using the Android Async-Http-Client library http://loopj.com/android-async-http/ to make multiple call request from different methods in a class so my code is something like this

RestClient.post(context, "", entity, "application/json", new JsonHttpResponseHandler() {
                @Override
                public void onSuccess(int statusCode, Header[] headers, JSONObject response) {

                }

                @Override
                public void onSuccess(int statusCode, Header[] headers, JSONArray timeline) {
                    // Map objects from json using gson
                }
            });

if different methods in my classes making similar calls like the code Above but with different request params, how can i encapsulate the ResponseHandler Callback so i don't have to keep repeating it in every method call. Was wondering if there is any other nice design pattern method i can use here.

Thanks

Related posts

Recent Viewed