Android Open Source - FragmentTutorial Request Manager






From Project

Back to project page FragmentTutorial.

License

The source code is released under:

Apache License

If you think the Android project FragmentTutorial listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.yanlu.android.fragment.net;
/*www. j  a  v a  2  s .co m*/
import android.content.Context;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;

/**
 * Manager for the queue
 * 
 * @author Trey Robinson
 *
 */
public class RequestManager {
  
  /**
   * the queue :-)
   */
  private static RequestQueue mRequestQueue;

  /**
   * Nothing to see here.
   */
  private RequestManager() {
   // no instances
  } 

  /**
   * @param context
   *       application context
   */
  public static void init(Context context) {
    mRequestQueue = Volley.newRequestQueue(context);
  }

  /**
   * @return
   *     instance of the queue
   * @throws
   *     IllegalStateException if init has not yet been called
   */
  public static RequestQueue getRequestQueue() {
      if (mRequestQueue != null) {
          return mRequestQueue;
      } else {
          throw new IllegalStateException("Not initialized");
      }
  }
}




Java Source Code List

com.yanlu.android.fragment.App.java
com.yanlu.android.fragment.MainActivity.java
com.yanlu.android.fragment.SettingsActivity.java
com.yanlu.android.fragment.frg.FragmentByXml.java
com.yanlu.android.fragment.frg.LeftFragment.java
com.yanlu.android.fragment.frg.RightFragment.java
com.yanlu.android.fragment.model.DemoDataMo.java
com.yanlu.android.fragment.model.DemoParcel.java
com.yanlu.android.fragment.net.GsonRequest.java
com.yanlu.android.fragment.net.LruBitmapCache.java
com.yanlu.android.fragment.net.RequestManager.java