当前位置: 首页>>代码示例>>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;未经允许,请勿转载。