Example usage for android.app Activity getApplicationContext

List of usage examples for android.app Activity getApplicationContext

Introduction

In this page you can find the example usage for android.app Activity getApplicationContext.

Prototype

@Override
    public Context getApplicationContext() 

Source Link

Usage

From source file:com.Jsu.framework.image.imageChooser.BChooser.java

public BChooser(Activity activity, int type, boolean shouldCreateThumbnails) {
    this.activity = activity;
    this.type = type;
    this.shouldCreateThumbnails = shouldCreateThumbnails;
    initDirectory(activity.getApplicationContext());
}

From source file:com.christophergs.mbientbasic.ModuleFragmentBase.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Activity owner = getActivity();
    if (!(owner instanceof FragmentBus)) {
        throw new ClassCastException(String.format(Locale.US, "%s %s", owner.toString(),
                owner.getString(R.string.error_fragment_bus)));
    }/*from  w  w w .j  a  v a 2s  .com*/

    fragBus = (FragmentBus) owner;
    owner.getApplicationContext().bindService(new Intent(owner, MetaWearBleService.class), this,
            Context.BIND_AUTO_CREATE);
}

From source file:com.yangtsaosoftware.pebblemessenger.activities.SetupFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    ((NavigationActivity) activity).onSectionAttached(positionIndex);
    _context = activity.getApplicationContext();

}

From source file:com.mbientlab.metawear.app.ModuleFragmentBase.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);

    if (!(activity instanceof FragmentBus)) {
        throw new ClassCastException(String.format(Locale.US, "%s %s", activity.toString(),
                activity.getString(R.string.error_fragment_bus)));
    }/*from ww w. ja  va 2 s  .  co m*/

    fragBus = (FragmentBus) activity;
    activity.getApplicationContext().bindService(new Intent(activity, MetaWearBleService.class), this,
            Context.BIND_AUTO_CREATE);
}

From source file:org.jboss.aerogear.android.authentication.impl.loader.AuthenticationModuleAdapter.java

public AuthenticationModuleAdapter(Activity activity, AuthenticationModule module, String name) {
    this.module = module;
    this.manager = activity.getLoaderManager();
    this.applicationContext = activity.getApplicationContext();
    this.activity = activity;
    this.fragment = null;
    this.name = name;
    this.handler = new Handler(Looper.getMainLooper());
}

From source file:com.tafayor.selfcamerashot.camera.CameraMenu.java

public CameraMenu(Activity activity) {
    super(activity);

    mContext = activity.getApplicationContext();
}

From source file:ir.isilearning.lmsapp.adapter.CategoryAdapter.java

public CategoryAdapter(Activity activity, List<gUserExamDetail> userExamDetailList) {
    mActivity = activity;//  ww w  .  j a va2s  .  co  m
    mResources = mActivity.getResources();
    mPackageName = mActivity.getPackageName();
    mLayoutInflater = LayoutInflater.from(activity.getApplicationContext());
    mExamDetailList = userExamDetailList;
    updateCategories(activity);
}

From source file:com.android.argb.edhlc.Utils.java

public static ActivePlayer loadPlayerFromSharedPreferences(Activity activity, int tag) {
    SharedPreferences prefs = activity.getSharedPreferences(Constants.PREFERENCE_NAME, Activity.MODE_PRIVATE);
    String pName = prefs.getString(tag + Constants.CURRENT_GAME_PLAYER_NAME, "");
    String pPlayerDeck = prefs.getString(tag + Constants.CURRENT_GAME_PLAYER_DECK, "");
    int[] pColor = {
            prefs.getInt(tag + Constants.CURRENT_GAME_PLAYER_COLOR1,
                    ContextCompat.getColor(activity.getApplicationContext(), R.color.primary_color)),
            prefs.getInt(tag + Constants.CURRENT_GAME_PLAYER_COLOR1,
                    ContextCompat.getColor(activity.getApplicationContext(), R.color.primary_color)) };
    boolean pIsAlive = prefs.getBoolean(tag + Constants.CURRENT_GAME_PLAYER_IS_ALIVE, true);
    int pLife = prefs.getInt(tag + Constants.CURRENT_GAME_PLAYER_LIFE, 40);
    int pEDH1 = prefs.getInt(tag + Constants.CURRENT_GAME_PLAYER_EDH1, 0);
    int pEDH2 = prefs.getInt(tag + Constants.CURRENT_GAME_PLAYER_EDH2, 0);
    int pEDH3 = prefs.getInt(tag + Constants.CURRENT_GAME_PLAYER_EDH3, 0);
    int pEDH4 = prefs.getInt(tag + Constants.CURRENT_GAME_PLAYER_EDH4, 0);

    return new ActivePlayer(new Deck(pName, pPlayerDeck, pColor), pIsAlive, pLife, pEDH1, pEDH2, pEDH3, pEDH4,
            tag);// w  w  w  .  j av a2 s.c  o m
}

From source file:com.dabay6.libraries.androidshared.ui.fragments.BaseListFragment.java

/**
 * {@inheritDoc}/*from w  ww .  ja  v  a 2  s . c o m*/
 */
@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    if (activity instanceof FragmentLifeCycleListener) {
        onFragmentLifeCycleListener = (FragmentLifeCycleListener) activity;
        onFragmentLifeCycleListener.onFragmentAttached(this);
    }

    applicationContext = activity.getApplicationContext();
}

From source file:com.halzhang.android.apps.startupnews.ui.tablet.DiscussFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    mJsoupFactory = JsoupFactory.getInstance(activity.getApplicationContext());
    if (activity instanceof OnMenuSelectedListener) {
        mListener = (OnMenuSelectedListener) activity;
    }//from  w w  w .j a v a  2s  . c  o m
}