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:com.mybitcoin.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.loaderManager = getLoaderManager();
    this.timerFlag = true;
}

From source file:org.deviceconnect.android.deviceplugin.uvc.fragment.UVCDeviceListFragment.java

/**
 * Gets a instance of UVCDeviceManager.//from  w w  w  . ja va2s  . c  o  m
 *
 * @return UVCDeviceManager
 */
private UVCDeviceManager getManager() {
    Activity activity = getActivity();
    if (activity == null) {
        return null;
    }
    UVCDeviceApplication application = (UVCDeviceApplication) activity.getApplication();
    return application.getDeviceManager();
}

From source file:org.hopestarter.wallet.ui.RequestCoinsFragment.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();
    this.clipboardManager = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE);
    this.bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    this.nfcAdapter = NfcAdapter.getDefaultAdapter(activity);
}

From source file:biz.wiz.android.wallet.ui.TransactionsListFragment.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.resolver = activity.getContentResolver();
    this.loaderManager = getLoaderManager();
}

From source file:com.kncwallet.wallet.ui.ReceiveFragment.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.loaderManager = getLoaderManager();
    this.nfcManager = (NfcManager) activity.getSystemService(Context.NFC_SERVICE);
    this.clipboardManager = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE);
}

From source file:cc.mintcoin.wallet.ui.RequestCoinsFragment.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();
    this.nfcManager = (NfcManager) activity.getSystemService(Context.NFC_SERVICE);
    this.clipboardManager = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE);
    this.bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
}

From source file:cc.mintcoin.wallet.ui.TransactionsListFragment.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.nfcManager = (NfcManager) activity.getSystemService(Context.NFC_SERVICE);
    this.resolver = activity.getContentResolver();
    this.loaderManager = getLoaderManager();
}

From source file:com.kncwallet.wallet.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.nfcManager = (NfcManager) activity.getSystemService(Context.NFC_SERVICE);
    this.resolver = activity.getContentResolver();
    this.loaderManager = getLoaderManager();
}

From source file:com.jefftharris.passwdsafe.FileListFragment.java

/** Update files after the loader is complete */
private void updateFiles(List<Map<String, Object>> fileData) {
    SimpleAdapter adapter = null;// w ww  .j av a 2s.co m
    if (fileData != null) {
        adapter = new SimpleAdapter(getActivity(), fileData, R.layout.file_list_item,
                new String[] { TITLE, ICON, MOD_DATE }, new int[] { R.id.text, R.id.icon, R.id.mod_date });
        adapter.setViewBinder(new SimpleAdapter.ViewBinder() {
            @Override
            public boolean setViewValue(View view, Object data, String textRepresentation) {
                switch (view.getId()) {
                case R.id.text: {
                    TextView tv = (TextView) view;
                    tv.setText(textRepresentation);
                    tv.requestLayout();
                    return true;
                }
                case R.id.mod_date: {
                    if (data == null) {
                        view.setVisibility(View.GONE);
                        return true;
                    } else {
                        view.setVisibility(View.VISIBLE);
                        return false;
                    }
                }
                }
                return false;
            }
        });
    }

    View rootView = getView();
    if (rootView == null) {
        // Fragment destroyed
        return;
    }
    View groupPanel = rootView.findViewById(R.id.current_group_panel);
    TextView groupLabel = (TextView) rootView.findViewById(R.id.current_group_label);
    TextView emptyLabel = (TextView) rootView.findViewById(android.R.id.empty);
    if (itsDir == null) {
        groupPanel.setVisibility(View.GONE);
        groupLabel.setText("");
        emptyLabel.setText(R.string.ext_storage_not_mounted);
    } else {
        groupPanel.setVisibility(View.VISIBLE);
        groupLabel.setText(itsDir.toString());
        emptyLabel.setText(R.string.no_files);
    }

    setListAdapter(adapter);

    // Open the default file
    if (getListAdapter() != null) {
        Activity act = getActivity();
        PasswdSafeApp app = (PasswdSafeApp) act.getApplication();
        if (app.checkOpenDefault()) {
            SharedPreferences prefs = Preferences.getSharedPrefs(act);
            Uri defFile = Preferences.getDefFilePref(prefs);
            if (defFile != null) {
                itsListener.openFile(defFile, null);
            }
        }
    }
}

From source file:com.matthewmitchell.peercoin_android_wallet.ui.TransactionsListFragment.java

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

    this.activity = (AbstractWalletActivity) activity;
    this.application = (WalletApplication) activity.getApplication();
    this.resolver = activity.getContentResolver();
    this.loaderManager = getLoaderManager();
}