Android Open Source - DualReader-Android Global Context Application






From Project

Back to project page DualReader-Android.

License

The source code is released under:

Apache License

If you think the Android project DualReader-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.

Java Source Code

package com.diego4aim.dualreader.util;
/*from w  w  w.  j  av a2s  .  c  o  m*/
import android.app.Application;
import android.content.Context;

/**
 * Facility to help non-Android-specific classes reach the {@link Application}
 * environment.
 * <p/>
 * If you want the application resources to be available everywhere, modify the
 * application manifest (AndroidManifest.xml) by adding this attribute to the
 * &lt;application&gt; element:
 * <p/>
 * android:name="com.diego4aim.dualreader.util.GlobalContextApplication"
 */
public class GlobalContextApplication extends Application {

    private static Context mContext = null;

    /**
     * Exposes the application Context, allowing any component in the
     * application to access resources like
     * <p/>
     * GlobalContextApplication.getContext().getResources()...
     */
    public static Context getContext() {
        return mContext;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        mContext = getApplicationContext();
    }

}




Java Source Code List

com.diego4aim.dualreader.AsyncPageRetriever.java
com.diego4aim.dualreader.DualReaderActivity.java
com.diego4aim.dualreader.PageRetrievalStrategy.java
com.diego4aim.dualreader.util.BackgroundSelector.java
com.diego4aim.dualreader.util.GlobalContextApplication.java