package com.socioboard.iboardpro; import android.app.Application; import android.text.TextUtils; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.toolbox.ImageLoader; import com.android.volley.toolbox.Volley; import com.appnext.appnextsdk.AppnextTrack; import com.flurry.android.FlurryAgent; public class AppController extends Application { public static final String TAG = AppController.class.getSimpleName(); private RequestQueue mRequestQueue; private ImageLoader mImageLoader; private static AppController mInstance; @Override public void onCreate() { // TODO Auto-generated method stub super.onCreate(); mInstance = this; AppnextTrack.track(this); // Parse.initialize(MainApplication.this, // "Mkrk7mvkJWi9jlp1vFnoF2XqWujFvMARLS9tNGTF","JaU9gaRLcSELIYBod0fslwniLVAOiMCIEVG7mGrn"); FlurryAgent.setLogEnabled(false); // init Flurry FlurryAgent.init(this, ApplicationData.flurryID); } public static synchronized AppController getInstance() { return mInstance; } public RequestQueue getRequestQueue() { if (mRequestQueue == null) { mRequestQueue = Volley.newRequestQueue(getApplicationContext()); } return mRequestQueue; } public <T> void addToRequestQueue(Request<T> req, String tag) { // set the default tag if tag is empty req.setTag(TextUtils.isEmpty(tag) ? TAG : tag); getRequestQueue().add(req); } public <T> void addToRequestQueue(Request<T> req) { req.setTag(TAG); getRequestQueue().add(req); } public void cancelPendingRequests(Object tag) { if (mRequestQueue != null) { mRequestQueue.cancelAll(tag); } } }