Back to project page Teracast-Android.
The source code is released under:
Apache License
If you think the Android project Teracast-Android 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.davidtpate.teracast; //from w w w . j av a2 s. com import android.app.Application; import android.app.Instrumentation; import android.content.Context; import com.davidtpate.teracast.model.Podcast; import com.davidtpate.teracast.model.PodcastList; import com.davidtpate.teracast.module.RootModule; import com.davidtpate.teracast.util.Ln; import com.github.kevinsawicki.http.HttpRequest; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Map; import static android.os.Build.VERSION.SDK_INT; import static android.os.Build.VERSION_CODES.FROYO; /** * Android Bootstrap application */ public class BaseApplication extends Application { private PodcastList mPodcastList = null; private static BaseApplication instance; /** * Create main application */ public BaseApplication() { // Disable http.keepAlive on Froyo and below if (SDK_INT <= FROYO) { HttpRequest.keepAlive(false); } } /** * Create main application * * @param context */ public BaseApplication(final Context context) { this(); attachBaseContext(context); } @Override public void onCreate() { super.onCreate(); instance = this; // Perform injection Injector.init(getRootModule(), this); BufferedReader reader = new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.podcasts_giant))); String fakeJson = ""; String line; try { line = reader.readLine(); while (line != null) { fakeJson = fakeJson + line; line = reader.readLine(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } instance.setPodcastList(PodcastList.fromJson(fakeJson)); } private Object getRootModule() { return new RootModule(); } /** * Create main application * * @param instrumentation */ public BaseApplication(final Instrumentation instrumentation) { this(); attachBaseContext(instrumentation.getTargetContext()); } public static BaseApplication getInstance() { return instance; } public PodcastList getPodcastList() { return mPodcastList; } public void setPodcastList(PodcastList mPodcastList) { this.mPodcastList = mPodcastList; } }