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.nick.scalpel.core.AutoBindWirer.java

@Override
public void wire(Activity activity, Field field) {
    wire(activity.getApplicationContext(), activity, field);
}

From source file:it.rainbowbreeze.playtog.ui.StartGameFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    ((MyApp) activity.getApplicationContext()).inject(this);
}

From source file:com.supremainc.biostar2.main.HomeActivityLayout.java

public HomeActivityLayout(Activity activity) {
    mActivity = activity;/*  w  w w  .jav  a 2 s  . com*/
    mContext = activity.getApplicationContext();
    mAppDataProvider = AppDataProvider.getInstance(mContext);
    mUserDataProvider = UserDataProvider.getInstance(mContext);
    mNotiProvider = NotificationDBProvider.getInstance(mContext);
}

From source file:lordkbx.FileHash.FileHash.java

public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    this.webView = webView;
    Activity activity = cordova.getActivity();
    this.context = activity.getApplicationContext();
    this.AppId = context.getPackageName();
}

From source file:com.iwedia.adapters.ListViewTimeAdapter.java

public ListViewTimeAdapter(Activity activity, ArrayList<String> channelNames, ArrayList<TimeEvent> timeEvents,
        int time) {
    mContext = activity.getApplicationContext();
    mLayoutInflater = activity.getLayoutInflater();
    mChannelNames = channelNames;/*www .ja va 2  s  .  co  m*/
    initializeEvents(timeEvents, time);
}

From source file:com.ota.updates.fragments.AboutFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    mContext = activity.getApplicationContext();
    try {//from   w w  w. j  a  va  2s .c  o  m
        mListener = (FragmentInteractionListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement OnFragmentInteractionListener");
    }
}

From source file:com.commonsware.android.fts.ModelFragment.java

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

    EventBus.getDefault().register(this);

    if (app == null) {
        app = host.getApplicationContext();
        new FetchQuestionsThread().start();
    }/*from w w  w. j av a2 s  .c  o  m*/
}

From source file:org.apache.cordova.filesystemroots.FileSystemRoots.java

@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);

    Activity activity = cordova.getActivity();
    Context context = activity.getApplicationContext();

    availableFilesystems = new HashMap<String, String>();
    availableFilesystems.put("files", context.getFilesDir().getAbsolutePath());
    availableFilesystems.put("files-external", context.getExternalFilesDir(null).getAbsolutePath());
    availableFilesystems.put("documents", new File(context.getFilesDir(), "Documents").getAbsolutePath());
    availableFilesystems.put("sdcard", Environment.getExternalStorageDirectory().getAbsolutePath());
    availableFilesystems.put("cache", context.getCacheDir().getAbsolutePath());
    availableFilesystems.put("cache-external", context.getExternalCacheDir().getAbsolutePath());
    availableFilesystems.put("root", "/");

    installedFilesystems = new HashSet<String>();

    String filesystemsStr = activity.getIntent().getStringExtra("androidextrafilesystems");
    if (filesystemsStr == null) {
        filesystemsStr = "files,files-external,documents,sdcard,cache,cache-external";
    }/*from  ww  w  . j a  v a  2 s .c o m*/

    String[] filesystems = filesystemsStr.split(",");

    FileUtils filePlugin = (FileUtils) webView.pluginManager.getPlugin("File");
    if (filePlugin != null) {
        /* Register filesystems in order */
        for (String fsName : filesystems) {
            if (!installedFilesystems.contains(fsName)) {
                String fsRoot = availableFilesystems.get(fsName);
                if (fsRoot != null) {
                    File newRoot = new File(fsRoot);
                    if (newRoot.mkdirs() || newRoot.isDirectory()) {
                        filePlugin.registerFilesystem(new LocalFilesystem(fsName, cordova, fsRoot));
                        installedFilesystems.add(fsName);
                    } else {
                        Log.d(TAG, "Unable to create root dir for fileystem \"" + fsName + "\", skipping");
                    }
                } else {
                    Log.d(TAG, "Unrecognized extra filesystem identifier: " + fsName);
                }
            }
        }
    } else {
        Log.w(TAG, "File plugin not found; cannot initialize file-system-roots plugin");
    }

}

From source file:jahirfiquitiva.iconshowcase.tasks.WallpaperToCrop.java

@Override
protected void onPreExecute() {
    final Activity a = wrActivity.get();
    if (a != null) {
        this.context = a.getApplicationContext();
    }/*  ww w .j  av a2s  .c  o m*/

}

From source file:net.istorya.fragment.CategoryListFragment.java

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

    mContext = activity.getApplicationContext();
    mCategoryListFragmentListener = (CategoryListFragmentListener) activity;
}