List of usage examples for android.content Context getApplicationContext
public abstract Context getApplicationContext();
From source file:com.akalizakeza.apps.ishusho.activity.NewPostUploadTaskFragment.java
@Override public void onAttach(Context context) { super.onAttach(context); if (context instanceof TaskCallbacks) { mCallbacks = (TaskCallbacks) context; } else {//from w ww. jav a 2 s. com throw new RuntimeException(context.toString() + " must implement TaskCallbacks"); } mApplicationContext = context.getApplicationContext(); }
From source file:com.aniruddhc.acemusic.player.AsyncTasks.AsyncAutoGetAlbumArtTask.java
public AsyncAutoGetAlbumArtTask(Context context, Activity activity) { mContext = context;/* w w w . j a va 2s.c om*/ mApp = (Common) context.getApplicationContext(); mActivity = activity; sharedPreferences = mContext.getSharedPreferences("com.aniruddhc.acemusic.player", Context.MODE_PRIVATE); task = this; dbHelper = new DBAccessHelper(mContext); }
From source file:com.Duo.music.player.AsyncTasks.AsyncAutoGetAlbumArtTask.java
public AsyncAutoGetAlbumArtTask(Context context, Activity activity) { mContext = context;//from ww w . j a va2 s .co m mApp = (Common) context.getApplicationContext(); mActivity = activity; sharedPreferences = mContext.getSharedPreferences("com.jams.music.player", Context.MODE_PRIVATE); task = this; dbHelper = new DBAccessHelper(mContext); }
From source file:com.jelly.music.player.AsyncTasks.AsyncAutoGetAlbumArtTask.java
public AsyncAutoGetAlbumArtTask(Context context, Activity activity) { mContext = context;//from w w w .j av a 2s . com mApp = (Common) context.getApplicationContext(); mActivity = activity; sharedPreferences = mContext.getSharedPreferences("com.jelly.music.player", Context.MODE_PRIVATE); task = this; dbHelper = new DBAccessHelper(mContext); }
From source file:com.owncloud.android.oc_framework.operations.RemoteOperation.java
/** * Synchronously executes the remote operation on the received ownCloud account. * // w ww . j a v a 2 s. c om * Do not call this method from the main thread. * * This method should be used whenever an ownCloud account is available, instead of {@link #execute(WebdavClient)}. * * @param account ownCloud account in remote ownCloud server to reach during the execution of the operation. * @param context Android context for the component calling the method. * @return Result of the operation. */ public final RemoteOperationResult execute(Account account, Context context) { if (account == null) throw new IllegalArgumentException("Trying to execute a remote operation with a NULL Account"); if (context == null) throw new IllegalArgumentException("Trying to execute a remote operation with a NULL Context"); mAccount = account; mContext = context.getApplicationContext(); try { mClient = OwnCloudClientFactory.createOwnCloudClient(mAccount, mContext); } catch (Exception e) { Log.e(TAG, "Error while trying to access to " + mAccount.name, e); return new RemoteOperationResult(e); } return run(mClient); }
From source file:applicationVo.UserProfileDataAsync.java
public UserProfileDataAsync(Context context) { sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); chatinstance = ChatSingleton.getInstance(); this.context = context; }
From source file:com.openerp.orm.OEHelper.java
public OEHelper(Context context, OEDatabase oeDatabase) { Log.d(TAG, "OEHelper->OEHelper()"); init();/*w w w. j a v a 2 s . c o m*/ mContext = context; mDatabase = oeDatabase; mApp = (App) context.getApplicationContext(); mOpenERP = mApp.getOEInstance(); mUser = OEUser.current(context); if (mOpenERP == null && mUser != null) mUser = login(mUser.getUsername(), mUser.getPassword(), mUser.getDatabase(), mUser.getHost()); }
From source file:com.owncloud.android.operations.RemoteOperation.java
/** * Synchronously executes the remote operation on the received ownCloud account. * /*from www . j a va 2 s.com*/ * Do not call this method from the main thread. * * This method should be used whenever an ownCloud account is available, instead of {@link #execute(WebdavClient)}. * * @param account ownCloud account in remote ownCloud server to reach during the execution of the operation. * @param context Android context for the component calling the method. * @return Result of the operation. */ public final RemoteOperationResult execute(Account account, Context context) { if (account == null) throw new IllegalArgumentException("Trying to execute a remote operation with a NULL Account"); if (context == null) throw new IllegalArgumentException("Trying to execute a remote operation with a NULL Context"); mAccount = account; mContext = context.getApplicationContext(); try { mClient = OwnCloudClientUtils.createOwnCloudClient(mAccount, mContext); } catch (Exception e) { Log_OC.e(TAG, "Error while trying to access to " + mAccount.name, e); return new RemoteOperationResult(e); } return run(mClient); }
From source file:com.roamtouch.menuserver.utils.FileUtils.java
public FileUtils(Context context) { app = ((MenuServerApplication) context.getApplicationContext()); }
From source file:org.wso2.app.catalog.utils.CommonUtils.java
/** * Calls the secured API.//from w w w . j a v a 2 s. c om * @param context -The Activity which calls an API.. * @param endpoint -The API endpoint. * @param methodType -The method type. * @param apiResultCallBack -The API result call back object. * @param requestCode -The request code. */ public static void callSecuredAPI(Context context, String endpoint, HTTP_METHODS methodType, String requestParams, APIResultCallBack apiResultCallBack, int requestCode) { EndPointInfo apiUtilities = new EndPointInfo(); ServerConfig utils = new ServerConfig(); apiUtilities.setEndPoint(endpoint); apiUtilities.setHttpMethod(methodType); if (requestParams != null) { apiUtilities.setRequestParams(requestParams); } APIController apiController; if (org.wso2.emm.agent.proxy.utils.Constants.Authenticator.AUTHENTICATOR_IN_USE .equals(org.wso2.emm.agent.proxy.utils.Constants.Authenticator.MUTUAL_SSL_AUTHENTICATOR)) { apiController = new APIController(); apiController.securedNetworkCall(apiResultCallBack, requestCode, apiUtilities, context); } else { String clientKey = Preference.getString(context, Constants.CLIENT_ID); String clientSecret = Preference.getString(context, Constants.CLIENT_SECRET); if (utils.getHostFromPreferences(context) != null && !utils.getHostFromPreferences(context).isEmpty() && clientKey != null && !clientKey.isEmpty() && !clientSecret.isEmpty()) { apiController = new APIController(clientKey, clientSecret); apiController.invokeAPI(apiUtilities, apiResultCallBack, requestCode, context.getApplicationContext()); } } }