Back to project page Volley-Ball.
The source code is released under:
MIT License
If you think the Android project Volley-Ball listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.siu.android.volleyball.samples; //from ww w . j av a 2 s . com import android.content.Context; import android.database.sqlite.SQLiteDatabase; import com.siu.android.volleyball.BallRequestQueue; import com.siu.android.volleyball.mock.FileMockNetwork; import com.siu.android.volleyball.samples.database.DatabaseHelper; import com.siu.android.volleyball.samples.volley.fake.FakeNetwork; import com.siu.android.volleyball.samples.volley.OkHttpStack; import com.siu.android.volleyball.toolbox.VolleyBall; import com.siu.android.volleyball.toolbox.VolleyBallConfig; /** * Created by lukas on 8/29/13. */ public class Application extends android.app.Application { private static Context sContext; private static BallRequestQueue sRequestQueue; private static BallRequestQueue sScenarioRequestQueue; private static DatabaseHelper sDatabaseHelper; private static SQLiteDatabase sSQLiteDatabase; @Override public void onCreate() { super.onCreate(); sContext = getApplicationContext(); if (Constants.DEBUG) { deleteDatabase(DatabaseHelper.NAME); } // init volley ball VolleyBallConfig.Builder configBuilder = new VolleyBallConfig.Builder(sContext); // mock if (Constants.MOCK_WEBSERVICE) { FileMockNetwork network = new FileMockNetwork(sContext, new FileMockNetwork.Config() .basePath("fakeapi") .requestDuration(1) .realNetworkHttpStack(new OkHttpStack())); configBuilder.network(network); } else { configBuilder.httpStack(new OkHttpStack()); } sRequestQueue = VolleyBall.newRequestQueue(configBuilder.build()); sScenarioRequestQueue = VolleyBall.newRequestQueue(new VolleyBallConfig.Builder(sContext) .network(new FakeNetwork()) .build()); // init database helper sDatabaseHelper = new DatabaseHelper(sContext); sSQLiteDatabase = sDatabaseHelper.getWritableDatabase(); } public static Context getContext() { return sContext; } public static BallRequestQueue getRequestQueue() { return sRequestQueue; } public static BallRequestQueue getScenarioRequestQueue() { return sScenarioRequestQueue; } public static DatabaseHelper getDatabaseHelper() { return sDatabaseHelper; } public static SQLiteDatabase getSQLiteDatabase() { return sSQLiteDatabase; } }