Tabnine Logo
Context.getApplicationContext
Code IndexAdd Tabnine to your IDE (free)

How to use
getApplicationContext
method
in
android.content.Context

Best Java code snippets using android.content.Context.getApplicationContext (Showing top 20 results out of 10,701)

origin: bumptech/glide

@SuppressWarnings("WeakerAccess")
public MediaStoreImageThumbLoader(Context context) {
 this.context = context.getApplicationContext();
}
origin: bumptech/glide

@SuppressWarnings("WeakerAccess")
public MediaStoreVideoThumbLoader(Context context) {
 this.context = context.getApplicationContext();
}
origin: airbnb/lottie-android

NetworkCache(Context appContext, String url) {
 this.appContext = appContext.getApplicationContext();
 this.url = url;
}
origin: bumptech/glide

public ResourceDrawableDecoder(Context context) {
 this.context = context.getApplicationContext();
}
origin: nostra13/Android-Universal-Image-Loader

public BaseImageDownloader(Context context, int connectTimeout, int readTimeout) {
  this.context = context.getApplicationContext();
  this.connectTimeout = connectTimeout;
  this.readTimeout = readTimeout;
}
origin: square/leakcanary

public static void setEnabledAsync(Context context, final Class<?> componentClass,
  final boolean enabled) {
 final Context appContext = context.getApplicationContext();
 AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
  @Override public void run() {
   setEnabledBlocking(appContext, componentClass, enabled);
  }
 });
}
origin: stackoverflow.com

 MySingleton.getInstance(Context c) {
  //
  // ... needing to create ...
  sInstance = new MySingleton(c.getApplicationContext());
}
origin: square/leakcanary

AndroidRefWatcherBuilder(@NonNull Context context) {
 this.context = context.getApplicationContext();
}
origin: square/leakcanary

public DefaultLeakDirectoryProvider(@NonNull Context context, int maxStoredHeapDumps) {
 if (maxStoredHeapDumps < 1) {
  throw new IllegalArgumentException("maxStoredHeapDumps must be at least 1");
 }
 this.context = context.getApplicationContext();
 this.maxStoredHeapDumps = maxStoredHeapDumps;
}
origin: bumptech/glide

DefaultConnectivityMonitor(@NonNull Context context, @NonNull ConnectivityListener listener) {
 this.context = context.getApplicationContext();
 this.listener = listener;
}
origin: square/picasso

static File createDefaultCacheDir(Context context) {
 File cache = new File(context.getApplicationContext().getCacheDir(), PICASSO_CACHE);
 if (!cache.exists()) {
  //noinspection ResultOfMethodCallIgnored
  cache.mkdirs();
 }
 return cache;
}
origin: airbnb/lottie-android

private NetworkFetcher(Context context, String url) {
 appContext = context.getApplicationContext();
 this.url = url;
 networkCache = new NetworkCache(appContext, url);
}
origin: bumptech/glide

private Api(Context context) {
 this.requestQueue = Volley.newRequestQueue(context.getApplicationContext());
 QueryListener queryListener = new QueryListener() {
  @Override
  public void onSearchCompleted(Query query, List<Photo> photos) {
   lastQueryResult = new QueryResult(query, photos);
  }
  @Override
  public void onSearchFailed(Query query, Exception e) {
   lastQueryResult = null;
  }
 };
 queryListeners.add(queryListener);
}
origin: square/picasso

/** Start building a new {@link Picasso} instance. */
public Builder(@NonNull Context context) {
 checkNotNull(context, "context == null");
 this.context = context.getApplicationContext();
}
origin: square/leakcanary

public static void install(@NonNull Context context, @NonNull RefWatcher refWatcher) {
 Application application = (Application) context.getApplicationContext();
 ActivityRefWatcher activityRefWatcher = new ActivityRefWatcher(application, refWatcher);
 application.registerActivityLifecycleCallbacks(activityRefWatcher.lifecycleCallbacks);
}
origin: square/leakcanary

public ServiceHeapDumpListener(@NonNull final Context context,
  @NonNull final Class<? extends AbstractAnalysisResultService> listenerServiceClass) {
 this.listenerServiceClass = checkNotNull(listenerServiceClass, "listenerServiceClass");
 this.context = checkNotNull(context, "context").getApplicationContext();
}
origin: androidannotations/androidannotations

@UiThread
@Trace
void showToast() {
  Toast.makeText(getContext().getApplicationContext(), "Hello World!", Toast.LENGTH_LONG).show();
}
origin: bumptech/glide

@VisibleForTesting
ByteBufferGifDecoder(
  Context context,
  List<ImageHeaderParser> parsers,
  BitmapPool bitmapPool,
  ArrayPool arrayPool,
  GifHeaderParserPool parserPool,
  GifDecoderFactory gifDecoderFactory) {
 this.context = context.getApplicationContext();
 this.parsers = parsers;
 this.gifDecoderFactory = gifDecoderFactory;
 this.provider = new GifBitmapProvider(bitmapPool, arrayPool);
 this.parserPool = parserPool;
}
origin: airbnb/lottie-android

/**
 * Parse an animation from raw/res. This is recommended over putting your animation in assets because
 * it uses a hard reference to R.
 * The resource id will be used as a cache key so future usages won't parse the json again.
 */
public static LottieTask<LottieComposition> fromRawRes(Context context, @RawRes final int rawRes) {
 // Prevent accidentally leaking an Activity.
 final Context appContext = context.getApplicationContext();
 return cache(rawResCacheKey(rawRes), new Callable<LottieResult<LottieComposition>>() {
  @Override public LottieResult<LottieComposition> call() {
   return fromRawResSync(appContext, rawRes);
  }
 });
}
origin: bumptech/glide

@VisibleForTesting
public static synchronized void tearDown() {
 if (glide != null) {
  glide.getContext()
    .getApplicationContext()
    .unregisterComponentCallbacks(glide);
  glide.engine.shutdown();
 }
 glide = null;
}
android.contentContextgetApplicationContext

Popular methods of Context

  • getPackageName
  • getResources
  • getSystemService
  • obtainStyledAttributes
  • getString
  • getPackageManager
  • startActivity
  • getContentResolver
  • getSharedPreferences
  • getAssets
  • getTheme
  • getCacheDir
  • getTheme,
  • getCacheDir,
  • startService,
  • sendBroadcast,
  • getFilesDir,
  • registerReceiver,
  • getApplicationInfo,
  • unregisterReceiver,
  • getExternalCacheDir

Popular in Java

  • Start an intent from android
  • getContentResolver (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • JComboBox (javax.swing)
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Runner (org.openjdk.jmh.runner)
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now