Example usage for android.app Activity getApplication

List of usage examples for android.app Activity getApplication

Introduction

In this page you can find the example usage for android.app Activity getApplication.

Prototype

public final Application getApplication() 

Source Link

Document

Return the application that owns this activity.

Usage

From source file:piuk.blockchain.android.ui.WalletTransactionsFragment.java

@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    this.activity = activity;
    application = (WalletApplication) activity.getApplication();
}

From source file:com.mygeopay.wallet.ui.ExchangeRatesFragment.java

@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

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

    this.loaderManager = getLoaderManager();
}

From source file:de.schildbach.wallet.ui.BackupWalletToSeedDialogFragment.java

@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    this.activity = (AbstractWalletActivity) activity;
    this.application = (WalletApplication) activity.getApplication();
    this.wallet = application.getWallet();
    this.pinRetryController = new PinRetryController(activity);
    this.config = application.getConfiguration();
}

From source file:org.level28.android.moca.ui.ItemListFragment.java

/**
 * Display a {@link Toast} after an exception occurred in background.
 * <p>/*from   w w w . ja  v  a 2 s. c om*/
 * Subclasses may want to override this method to change the exception
 * reporting method.
 * 
 * @param exception
 *            the exception thrown by the loader
 * @param messageResId
 *            string resource id returned by
 *            {@link #getErrorMessage(Exception)}
 */
protected void showError(final Exception exception, final int messageResId) {
    final Activity activity = getActivity();
    final Application application = activity.getApplication();
    final String message = activity.getResources().getString(messageResId);

    activity.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Toast.makeText(application, message, Toast.LENGTH_LONG).show();
        }
    });
}

From source file:com.bushstar.htmlcoin_android_wallet.ui.ExchangeRatesFragment.java

@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.contentUri = ExchangeRatesProvider.contentUri(activity.getPackageName());
    this.loaderManager = getLoaderManager();
}

From source file:de.schildbach.wallet.ui.WalletBalanceToolbarFragment.java

@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);
}

From source file:com.feathercoin.wallet.feathercoin.ui.TransactionsListFragment.java

@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    this.activity = (AbstractWalletActivity) activity;
    this.application = (WalletApplication) activity.getApplication();
    this.wallet = application.getWallet();
    this.prefs = PreferenceManager.getDefaultSharedPreferences(activity);
    this.resolver = activity.getContentResolver();
    this.loaderManager = getLoaderManager();
}

From source file:com.ultramegasoft.flavordex2.fragment.EditInfoFragment.java

@NonNull
@Override/*from  www .  j  ava2 s.  c  o m*/
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View root = super.onCreateView(inflater, container, savedInstanceState);

    mFormHelper = createHelper(root);

    mDateInputWidget = root.findViewById(R.id.entry_date);
    mRatingBar = root.findViewById(R.id.entry_rating);

    final Date date = new Date();
    mDateInputWidget.setDate(date);
    mDateInputWidget.setMaxDate(date);

    final Activity activity = getActivity();
    if (activity != null) {
        mFormHelper.mTxtLocation.setText(((FlavordexApp) activity.getApplication()).getLocationName());
    }

    return root;
}

From source file:de.schildbach.litecoinwallet.ui.RequestCoinsFragment.java

@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    this.activity = (AbstractBindServiceActivity) activity;
    this.application = (WalletApplication) activity.getApplication();
    this.wallet = application.getWallet();
    this.prefs = PreferenceManager.getDefaultSharedPreferences(activity);
    this.loaderManager = getLoaderManager();
    this.nfcManager = (NfcManager) activity.getSystemService(Context.NFC_SERVICE);
    this.clipboardManager = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE);
    this.bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
}

From source file:de.schildbach.wallet.ui.EncryptKeysDialogFragment.java

@Override
public void onAttach(final Activity activity) {
    super.onAttach(activity);

    this.activity = (AbstractWalletActivity) activity;
    this.application = (WalletApplication) activity.getApplication();
    this.wallet = application.getWallet();
    this.pinRetryController = new PinRetryController(getActivity());
}