当前位置: 首页>>代码示例>>Java>>正文


Java Activity.getApplication方法代码示例

本文整理汇总了Java中android.app.Activity.getApplication方法的典型用法代码示例。如果您正苦于以下问题:Java Activity.getApplication方法的具体用法?Java Activity.getApplication怎么用?Java Activity.getApplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.app.Activity的用法示例。


在下文中一共展示了Activity.getApplication方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: callJavaScript

import android.app.Activity; //导入方法依赖的package包/类
@ReactMethod
void callJavaScript() {
    Activity activity = getCurrentActivity();
    if (activity != null) {
        MainApplication application = (MainApplication) activity.getApplication();
        ReactNativeHost reactNativeHost = application.getReactNativeHost();
        ReactInstanceManager reactInstanceManager = reactNativeHost.getReactInstanceManager();
        ReactContext reactContext = reactInstanceManager.getCurrentReactContext();

        if (reactContext != null) {
            CatalystInstance catalystInstance = reactContext.getCatalystInstance();
            WritableNativeArray params = new WritableNativeArray();
            params.pushString("Hello, JavaScript!");
            catalystInstance.callFunction("JavaScriptVisibleToJava", "alert", params);
        }
    }
}
 
开发者ID:petterh,项目名称:react-native-android-activity,代码行数:18,代码来源:ActivityStarterModule.java

示例2: setPresenters

import android.app.Activity; //导入方法依赖的package包/类
public static void setPresenters(Activity activity, CommonPresenter.ExtendedClickListener listener, PresenterAdapterInterface adapterInterface, int viewMode){

        BrowserByVideoObjects.setPresenters(activity, listener, adapterInterface, viewMode);
        CustomApplication application = (CustomApplication) activity.getApplication();
        HttpImageManager imageManager = application.getHttpImageManager();
        if(viewMode==VideoUtils.VIEW_MODE_LIST) {
            adapterInterface.setPresenter(MetaFile2.class, new Metafile2ListPresenter(activity));
        }
        else if (viewMode == VideoUtils.VIEW_MODE_GRID_SHORT){
            adapterInterface.setPresenter(MetaFile2.class, new Metafile2GridPresenter(activity));

        }
        else if(viewMode==VideoUtils.VIEW_MODE_DETAILS){
            adapterInterface.setPresenter(MetaFile2.class, new Metafile2ListPresenter(activity));
        }
        else {
            adapterInterface.setPresenter(MetaFile2.class, new Metafile2GridPresenter(activity));
        }
    }
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:20,代码来源:BrowserByFolder.java

示例3: setPresenters

import android.app.Activity; //导入方法依赖的package包/类
public static void setPresenters(Activity activity, CommonPresenter.ExtendedClickListener listener, PresenterAdapterInterface adapterInterface, int viewMode){
    CustomApplication application = (CustomApplication) activity.getApplication();
    HttpImageManager imageManager = application.getHttpImageManager();
    if(viewMode== VideoUtils.VIEW_MODE_LIST) {
        adapterInterface.setPresenter(Video.class, new VideoListPresenter(activity, listener,imageManager));
    }
    else if (viewMode == VideoUtils.VIEW_MODE_GRID_SHORT){
        adapterInterface.setPresenter(Video.class, new VideoGridShortPresenter(activity, listener, imageManager));

    }
    else if(viewMode==VideoUtils.VIEW_MODE_DETAILS){
        adapterInterface.setPresenter(NonIndexedVideo.class, new VideoListPresenter(activity, listener,imageManager));
        adapterInterface.setPresenter(Video.class, new VideoListPresenter(activity, listener,imageManager));
        adapterInterface.setPresenter(Episode.class, new ScrapedVideoDetailedPresenter(activity, listener,imageManager));
        adapterInterface.setPresenter(Movie.class, new ScrapedVideoDetailedPresenter(activity, listener,imageManager));
    }
    else {
        adapterInterface.setPresenter(Video.class, new VideoGridPresenter(activity, listener,imageManager));
    }
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:21,代码来源:BrowserByVideoObjects.java

示例4: findHasControllerInjector

import android.app.Activity; //导入方法依赖的package包/类
private static HasControllerInjector findHasControllerInjector(Controller controller) {
  Controller parentController = controller;

  do {
    if ((parentController = parentController.getParentController()) == null) {
      Activity activity = controller.getActivity();
      if (activity instanceof HasControllerInjector) {
        return (HasControllerInjector) activity;
      }

      if (activity.getApplication() instanceof HasControllerInjector) {
        return (HasControllerInjector) activity.getApplication();
      }

      throw new IllegalArgumentException(
          String.format("No injector was found for %s", new Object[] { controller.getClass().getCanonicalName() }));
    }
  } while (!(parentController instanceof HasControllerInjector));

  return (HasControllerInjector) parentController;
}
 
开发者ID:Bodo1981,项目名称:conductor-dagger,代码行数:22,代码来源:ConductorInjection.java

示例5: onResume

import android.app.Activity; //导入方法依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
    onShowDonationChanged();
    Preference preference = getPreferenceScreen().findPreference("brevent_about_developer");
    if (!SimpleSu.hasSu() && AppsDisabledFragment.isAdbRunning()) {
        preference.setSummary(R.string.brevent_about_developer_adb);
    } else {
        preference.setSummary(null);
    }
    preference.setOnPreferenceClickListener(this);
    if (BuildConfig.RELEASE) {
        Activity activity = getActivity();
        BreventApplication application = (BreventApplication) activity.getApplication();
        double donation = BreventApplication.getDonation(application);
        int playDonation = BreventApplication.getPlayDonation(application);
        String amount = DecimalUtils.format(donation + playDonation);
        if (mAmount == null) {
            mAmount = amount;
        } else if (!Objects.equals(mAmount, amount)) {
            activity.recreate();
        }
    }
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:26,代码来源:SettingsFragment.java

示例6: onAttach

import android.app.Activity; //导入方法依赖的package包/类
@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    this.activity = (AbstractWalletActivity) activity;
    this.application = (WalletApplication) activity.getApplication();
    this.wallet = application.getWallet();
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:9,代码来源:BackupWalletDialogFragment.java

示例7: onAttach

import android.app.Activity; //导入方法依赖的package包/类
@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    this.activity = activity;
    this.application = (WalletApplication) activity.getApplication();
    this.packageManager = activity.getPackageManager();
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:9,代码来源:AlertDialogsFragment.java

示例8: onAttach

import android.app.Activity; //导入方法依赖的package包/类
@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    this.activity = activity;
    this.application = (WalletApplication) activity.getApplication();
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:8,代码来源:DiagnosticsFragment.java

示例9: attach2Window

import android.app.Activity; //导入方法依赖的package包/类
public static ExplosionFieldView attach2Window(Activity activity) {
    ViewGroup rootView = (ViewGroup) activity.findViewById(Window.ID_ANDROID_CONTENT);
    ExplosionFieldView explosionField = new ExplosionFieldView(activity.getApplication());
    rootView.addView(explosionField, new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    return explosionField;
}
 
开发者ID:A-Miracle,项目名称:QiangHongBao,代码行数:8,代码来源:ExplosionFieldView.java

示例10: onAttach

import android.app.Activity; //导入方法依赖的package包/类
@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    this.activity = (AddressBookActivity) activity;
    this.application = (WalletApplication) activity.getApplication();
    this.config = application.getConfiguration();
    this.wallet = application.getWallet();
    this.clipboardManager = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE);
    this.contentResolver = activity.getContentResolver();
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:12,代码来源:WalletAddressesFragment.java

示例11: onShow

import android.app.Activity; //导入方法依赖的package包/类
@Override
public void onShow(DialogInterface dialog) {
    Activity activity = getActivity();
    if (activity == null) {
        return;
    }
    BreventApplication application = (BreventApplication) activity.getApplication();
    if (application.isUnsafe() || application.getPackageManager()
            .getLaunchIntentForPackage(DonateActivity.PACKAGE_ALIPAY) == null) {
        ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
    }
    if (!BreventActivity.hasEmailClient(application)) {
        ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_NEGATIVE).setEnabled(false);
    }
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:16,代码来源:AppsDonateFragment.java

示例12: onAttach

import android.app.Activity; //导入方法依赖的package包/类
@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    this.activity = (AbstractBindServiceActivity) activity;
    this.application = (WalletApplication) activity.getApplication();
    this.config = application.getConfiguration();
    this.wallet = application.getWallet();
    this.loaderManager = getLoaderManager();

    showLocalBalance = getResources().getBoolean(R.bool.show_local_balance);
    installedFromGooglePlay = "com.android.vending"
            .equals(application.getPackageManager().getInstallerPackageName(application.getPackageName()));
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:15,代码来源:WalletBalanceFragment.java

示例13: onAttach

import android.app.Activity; //导入方法依赖的package包/类
@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    this.activity = activity;
    final WalletApplication application = (WalletApplication) activity.getApplication();
    this.wallet = application.getWallet();
    this.contentResolver = activity.getContentResolver();
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:10,代码来源:EditAddressBookEntryFragment.java

示例14: onAttach

import android.app.Activity; //导入方法依赖的package包/类
@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    this.activity = activity;
    this.application = (WalletApplication) activity.getApplication();
    this.config = application.getConfiguration();
    this.loaderManager = getLoaderManager();
    this.nfcAdapter = NfcAdapter.getDefaultAdapter(activity);
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:11,代码来源:WalletAddressFragment.java

示例15: onAttach

import android.app.Activity; //导入方法依赖的package包/类
@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    this.activity = (AbstractWalletActivity) activity;
    this.application = (WalletApplication) activity.getApplication();
    this.config = application.getConfiguration();
    this.wallet = application.getWallet();
    this.loaderManager = getLoaderManager();
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:11,代码来源:RaiseFeeDialogFragment.java


注:本文中的android.app.Activity.getApplication方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。