當前位置: 首頁>>代碼示例>>Java>>正文


Java Application.getApplicationContext方法代碼示例

本文整理匯總了Java中android.app.Application.getApplicationContext方法的典型用法代碼示例。如果您正苦於以下問題:Java Application.getApplicationContext方法的具體用法?Java Application.getApplicationContext怎麽用?Java Application.getApplicationContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.app.Application的用法示例。


在下文中一共展示了Application.getApplicationContext方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initLocation

import android.app.Application; //導入方法依賴的package包/類
/**
 * Initializes the {@link LocationEngine} based on whether or not
 * simulation is enabled.
 */
@SuppressWarnings({"MissingPermission"})
private void initLocation(Application application) {
  if (!shouldSimulateRoute) {
    modelLocationEngine = new LostLocationEngine(application.getApplicationContext());
    modelLocationEngine.setPriority(LocationEnginePriority.HIGH_ACCURACY);
    modelLocationEngine.setFastestInterval(1000);
    modelLocationEngine.setInterval(0);
    this.locationEngine.setValue(modelLocationEngine);

    if (modelLocationEngine.getLastLocation() != null) {
      onLocationChanged(modelLocationEngine.getLastLocation());
    }
  } else {
    // Fire a null location update to fetch the route if we are launching with coordinates
    onLocationChanged(null);
  }
}
 
開發者ID:mapbox,項目名稱:mapbox-navigation-android,代碼行數:22,代碼來源:LocationViewModel.java

示例2: init

import android.app.Application; //導入方法依賴的package包/類
/**
 * 初始化庫
 *
 * @param isDebug 是否打印日誌
 * @param TAG     日誌TAG
 * @param context application
 */
public static void init(@NonNull boolean isDebug, @NonNull String TAG, @NonNull Application context) {
    android.util.Log.d(TAG_, "==============您使用的KUtils版本:2.4.2==============");
    if (TAG == null || context == null) throw new RuntimeException("KUtilLibs 初始化參數均不能為空");
    appContext = context.getApplicationContext();
    if (isDebug) Log.init(TAG, true);//開啟日誌打印
    DialogUIUtils.init(appContext);
    OkGo.getInstance().init(context);
}
 
開發者ID:weileng11,項目名稱:KUtils-master,代碼行數:16,代碼來源:KUtilLibs.java

示例3: install

import android.app.Application; //導入方法依賴的package包/類
public static void install(Application application) {
  mContext = application.getApplicationContext();
  Fresco.initialize(mContext);
  LogUtils.allowLog = !BuildConfig.DEBUG;
  XLog.init(BuildConfig.DEBUG ? LogLevel.ALL : LogLevel.NONE);
  SpUtil.init(mContext);
  if (LeakCanary.isInAnalyzerProcess(mContext)) {
    return;
  }
  LeakCanary.install(application);
}
 
開發者ID:MixAndroid,項目名稱:MixUtils,代碼行數:12,代碼來源:MixUtils.java

示例4: providePluginConfig

import android.app.Application; //導入方法依賴的package包/類
@Provides
PluginConfig providePluginConfig(@IoExecutor Executor ioExecutor,
		AndroidExecutor androidExecutor, SecureRandom random,
		SocketFactory torSocketFactory, BackoffFactory backoffFactory,
		Application app, LocationUtils locationUtils, DevReporter reporter,
		EventBus eventBus) {
	Context appContext = app.getApplicationContext();
	DuplexPluginFactory bluetooth = new DroidtoothPluginFactory(ioExecutor,
			androidExecutor, appContext, random, backoffFactory);
	DuplexPluginFactory tor = new TorPluginFactory(ioExecutor, appContext,
			locationUtils, reporter, eventBus, torSocketFactory,
			backoffFactory);
	DuplexPluginFactory lan = new AndroidLanTcpPluginFactory(ioExecutor,
			backoffFactory, appContext);
	final Collection<DuplexPluginFactory> duplex =
			Arrays.asList(bluetooth, tor, lan);
	@NotNullByDefault
	PluginConfig pluginConfig = new PluginConfig() {

		@Override
		public Collection<DuplexPluginFactory> getDuplexFactories() {
			return duplex;
		}

		@Override
		public Collection<SimplexPluginFactory> getSimplexFactories() {
			return Collections.emptyList();
		}
	};
	return pluginConfig;
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:32,代碼來源:AndroidPluginModule.java

示例5: start

import android.app.Application; //導入方法依賴的package包/類
/**
 * Inicia uma instancia da lib PlainRequest
 *
 * @param app
 */
public void start(Application app) {
    if(context == null) {
        context = app.getApplicationContext();
        queue = Volley.newRequestQueue(context); // Criação do RequestQueue
    }
}
 
開發者ID:giovanimoura,項目名稱:plainrequest,代碼行數:12,代碼來源:PlainRequestQueue.java

示例6: init

import android.app.Application; //導入方法依賴的package包/類
/**
 * 初始化工具類
 */
public static void init(@NonNull Application app) {
  if (isDebug()) {
    ARouter.openLog();
    ARouter.openDebug();
  }
  ARouter.init(app);
  Fresco.initialize(app.getApplicationContext());
  ZKBase.context = app.getApplicationContext();
}
 
開發者ID:ZhuoKeTeam,項目名稱:JueDiQiuSheng,代碼行數:13,代碼來源:ZKBase.java

示例7: AndroidNotificationManagerImpl

import android.app.Application; //導入方法依賴的package包/類
@Inject
AndroidNotificationManagerImpl(@DatabaseExecutor Executor dbExecutor,
		SettingsManager settingsManager, AndroidExecutor androidExecutor,
		Application app) {
	this.dbExecutor = dbExecutor;
	this.settingsManager = settingsManager;
	this.androidExecutor = androidExecutor;
	appContext = app.getApplicationContext();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:10,代碼來源:AndroidNotificationManagerImpl.java

示例8: init

import android.app.Application; //導入方法依賴的package包/類
/**
 * 初始化
 * @param application
 * @param isApplyImmediate 是否立刻生效
 */
public void init(Application application, boolean isApplyImmediate) {
    if (application == null)
        return;
    isInited = true;
    mContext = application.getApplicationContext();
    mAndroidSkinManager = new AndroidSkinManager(application.getApplicationContext());
    if (isApplyImmediate)
        mAndroidSkinManager.loadSkinIfApply();
    AndroidSkinHook.getInstance().registerActivityLife(application);
}
 
開發者ID:MeetYouDevs,項目名稱:Android-Skin,代碼行數:16,代碼來源:AndroidSkin.java

示例9: provideApplicationContext

import android.app.Application; //導入方法依賴的package包/類
@Provides @Singleton @ApplicationContext Context provideApplicationContext(
    Application application) {
  return application.getApplicationContext();
}
 
開發者ID:Arjun-sna,項目名稱:android-permission-checker-app,代碼行數:5,代碼來源:ApplicationModule.java

示例10: LoginViewModel

import android.app.Application; //導入方法依賴的package包/類
public LoginViewModel(Application context) {
    super(context);
    mContext = context.getApplicationContext();
}
 
開發者ID:InnoFang,項目名稱:Android-Code-Demos,代碼行數:5,代碼來源:LoginViewModel.java

示例11: AndroidLocationUtils

import android.app.Application; //導入方法依賴的package包/類
@Inject
AndroidLocationUtils(Application app) {
	appContext = app.getApplicationContext();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:5,代碼來源:AndroidLocationUtils.java

示例12: AndroidSecureRandomProvider

import android.app.Application; //導入方法依賴的package包/類
@Inject
AndroidSecureRandomProvider(Application app) {
	appContext = app.getApplicationContext();
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:5,代碼來源:AndroidSecureRandomProvider.java

示例13: EnvironmentalSensorsViewModel

import android.app.Application; //導入方法依賴的package包/類
@Inject
public EnvironmentalSensorsViewModel(Application context, EnvironmentalSensorsRepository environmentalSensorsRepository) {
    super(context);
    this.mContext = context.getApplicationContext();
    this.mEnvironmentalSensorsRepository = environmentalSensorsRepository;
}
 
開發者ID:igrow-systems,項目名稱:igrow-android,代碼行數:7,代碼來源:EnvironmentalSensorsViewModel.java

示例14: init

import android.app.Application; //導入方法依賴的package包/類
public static void init(Application application, OkHttpClient.Builder builder){
    context = application.getApplicationContext();
    if(builder!=null){
        okHttpClient = builder.build();
    }
}
 
開發者ID:jiajunhui,項目名稱:XHTTP,代碼行數:7,代碼來源:XHTTP.java

示例15: AppModule

import android.app.Application; //導入方法依賴的package包/類
public AppModule(Application application) {
  this.context = application.getApplicationContext();
}
 
開發者ID:jimandreas,項目名稱:android-rxmvp-sandbox,代碼行數:4,代碼來源:AppModule.java


注:本文中的android.app.Application.getApplicationContext方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。