Example usage for android.os Bundle getLong

List of usage examples for android.os Bundle getLong

Introduction

In this page you can find the example usage for android.os Bundle getLong.

Prototype

public long getLong(String key) 

Source Link

Document

Returns the value associated with the given key, or 0L if no mapping of the desired type exists for the given key.

Usage

From source file:com.bydavy.card.receipts.fragments.ReceiptEditFragment.java

private void fromSavedStateToData(Bundle savedState) {
    mValidReceipt = savedState.getBoolean(STATE_VALID_RECEIPT);
    if (mValidReceipt) {
        mShop = savedState.getString(STATE_SHOP);
        mDate.setTimeInMillis(savedState.getLong(STATE_DATE));
        mNote = savedState.getString(STATE_NOTE);
        mTotal = savedState.getFloat(STATE_TOTAL);
    }/*from   w w w  .j a  v a  2 s.  c  om*/
}

From source file:com.github.kanata3249.ffxieq.android.VWAtmaLevelSelectorActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    Bundle param;

    super.onCreate(savedInstanceState);

    if (savedInstanceState != null) {
        param = savedInstanceState;/*from  w  w  w.j a va 2  s  . c o  m*/
    } else {
        param = getIntent().getExtras();
    }

    mCurrent = param.getLong("Current");
    mFilterID = param.getLong("Filter");
    mSubId = param.getLong("SubId");

    setContentView(R.layout.vwatmaselector);
}

From source file:com.github.kanata3249.ffxieq.android.VWAtmaSelectorActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    Bundle param;

    super.onCreate(savedInstanceState);

    if (savedInstanceState != null) {
        param = savedInstanceState;//from  w w w.ja va 2 s  . c om
    } else {
        param = getIntent().getExtras();
    }

    mCurrent = param.getLong("Current");
    mIndex = param.getInt("Index");
    mFilterID = param.getLong("Filter");

    setContentView(R.layout.vwatmaselector);
}

From source file:cz.maresmar.sfm.view.menu.portal.PortalMenuPagerFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getArguments() != null) {
        mUserUri = getArguments().getParcelable(ARG_USER_URI);

        if (savedInstanceState == null) {
            mPortalId = getArguments().getLong(ARG_PORTAL_ID);
        } else {//w  w w  .j av a  2s.com
            mPortalId = savedInstanceState.getLong(ARG_PAGER_PAGE_ID);
        }

        getLoaderManager().initLoader(PORTAL_LOADER_ID, null, this);
    }
}

From source file:com.andrew.apollo.menu.PlaylistDialog.java

@Override
public void onCreate(Bundle icicle) {

    super.onCreate(icicle);
    setContentView(new LinearLayout(this));

    action = getIntent().getAction();//from   ww  w.  j a v a2s.  c  o m

    mRenameId = icicle != null ? icicle.getLong(INTENT_KEY_RENAME)
            : getIntent().getLongExtra(INTENT_KEY_RENAME, -1);
    mList = icicle != null ? icicle.getLongArray(INTENT_PLAYLIST_LIST)
            : getIntent().getLongArrayExtra(INTENT_PLAYLIST_LIST);
    if (INTENT_RENAME_PLAYLIST.equals(action)) {
        mOriginalName = nameForId(mRenameId);
        mDefaultName = icicle != null ? icicle.getString(INTENT_KEY_DEFAULT_NAME) : mOriginalName;
    } else if (INTENT_CREATE_PLAYLIST.equals(action)) {
        mDefaultName = icicle != null ? icicle.getString(INTENT_KEY_DEFAULT_NAME) : makePlaylistName();
        mOriginalName = mDefaultName;
    }

    DisplayMetrics dm = new DisplayMetrics();
    dm = getResources().getDisplayMetrics();

    mPlaylistDialog = new AlertDialog.Builder(this).create();
    mPlaylistDialog.setVolumeControlStream(AudioManager.STREAM_MUSIC);

    if (action != null && mRenameId >= 0 && mOriginalName != null || mDefaultName != null) {

        mPlaylist = new EditText(this);
        mPlaylist.setSingleLine(true);
        mPlaylist.setText(mDefaultName);
        mPlaylist.setSelection(mDefaultName.length());
        mPlaylist.addTextChangedListener(this);

        mPlaylistDialog.setIcon(android.R.drawable.ic_dialog_info);
        String promptformat;
        String prompt = "";
        if (INTENT_RENAME_PLAYLIST.equals(action)) {
            promptformat = getString(R.string.rename_playlist);
            prompt = String.format(promptformat, mOriginalName, mDefaultName);
        } else if (INTENT_CREATE_PLAYLIST.equals(action)) {
            promptformat = getString(R.string.new_playlist);
            prompt = String.format(promptformat, mDefaultName);
        }

        mPlaylistDialog.setTitle(prompt);
        mPlaylistDialog.setView(mPlaylist, (int) (8 * dm.density), (int) (8 * dm.density),
                (int) (8 * dm.density), (int) (4 * dm.density));
        if (INTENT_RENAME_PLAYLIST.equals(action)) {
            mPlaylistDialog.setButton(Dialog.BUTTON_POSITIVE, getString(R.string.save),
                    mRenamePlaylistListener);
            mPlaylistDialog.setOnShowListener(this);
        } else if (INTENT_CREATE_PLAYLIST.equals(action)) {
            mPlaylistDialog.setButton(Dialog.BUTTON_POSITIVE, getString(R.string.save),
                    mCreatePlaylistListener);
        }
        mPlaylistDialog.setButton(Dialog.BUTTON_NEGATIVE, getString(android.R.string.cancel),
                new OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {

                        finish();
                    }
                });
        mPlaylistDialog.setOnCancelListener(this);
        mPlaylistDialog.show();
    } else {
        Toast.makeText(this, R.string.error, Toast.LENGTH_SHORT).show();
        finish();
    }

}

From source file:org.ewicom.pps.unitinfo.TabAddressFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View rootView = inflater.inflate(R.layout.tab_address, container, false);

    Bundle args = getArguments();
    if (args != null) {
        this.unitID = args.getLong("unitID");
    }/*from  w w w  .  j a  va2s. c  om*/

    Button unitWebSite = (Button) rootView.findViewById(R.id.button_www);
    unitWebSite.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            openUnitWebsite(rootView);
        }
    });

    TextView openParent = (TextView) rootView.findViewById(R.id.text_unitparent);
    openParent.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            openParent(rootView);
        }
    });

    showImage = (TextView) rootView.findViewById(R.id.link_openimg);
    showImage.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            downloadImageAndShow();
        }
    });

    return rootView;
}

From source file:com.dabay6.android.apps.carlog.ui.base.fragments.BaseEditFragment.java

/**
 * @param savedInstanceState/*from  w  w w .  ja v  a  2  s.  c  om*/
 */
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    final Bundle bundle = getArguments();

    super.onActivityCreated(savedInstanceState);

    if (bundle == null) {
        return;
    }

    if (bundle.containsKey(PARAMS_ENTITY_ID)) {
        final LoaderManager manager = getLoaderManager();

        isInsert = false;
        entityId = bundle.getLong(PARAMS_ENTITY_ID);

        manager.restartLoader(ENTITY_LOADER_ID, null, this);
        //            if (manager.getLoader(ENTITY_LOADER_ID) == null) {
        //                manager.initLoader(ENTITY_LOADER_ID, null, this);
        //            }
        //            else {
        //                manager.restartLoader(ENTITY_LOADER_ID, null, this);
        //            }
    }
}

From source file:com.github.kanata3249.ffxieq.android.MagicSelectorActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    Bundle param;

    super.onCreate(savedInstanceState);

    if (savedInstanceState != null) {
        param = savedInstanceState;/*from ww w  .j ava2s  .com*/
    } else {
        param = getIntent().getExtras();
    }

    mIndex = param.getInt("Index");
    mCurrent = param.getLong("Current");
    mFilterID = param.getLong("Filter");
    mFilterByType = param.getString("FilterByType");
    mSubId = param.getLong("SubId");

    setContentView(R.layout.magicselector);
}

From source file:rpassmore.app.fillthathole.ViewHazardActivity.java

/**
 * loads the hazard and populates the ui from the id supplied in the bundle
 * @param b//from  w  ww.  jav a 2s  .  c o m
 * @return bool - true if a hazard was loaded
 */
private boolean createFromBundle(Bundle b) {
    if (b != null) {
        long id = b.getLong(SAVED_HAZARD_ID);
        if (id == -1) {
            hazard = new Hazard();
        } else {
            try {
                dbAdapter.open();
                hazard = dbAdapter.load(id);
                populateFromHazard();
                makeActivityReadOnly();
            } catch (SQLException e) {
                Log.e(getPackageName(), e.toString());
            } finally {
                dbAdapter.close();
            }
        }
        return true;
    }
    return false;
}

From source file:com.narkii.security.info.LicenseInfoFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle bundle) {
    // TODO Auto-generated method stub
    DbCursorLoader cursorLoader = null;/*  w w w  .  ja v  a2  s. c  o  m*/
    final DbOperations operations = DbOperations.getInstance(getActivity());
    final long rowId = bundle.getLong("id");
    if (id == Constants.PERMISSION_IMAGE_ID) {
        cursorLoader = new DbCursorLoader(getActivity()) {

            @Override
            public Cursor getDbCursor() {
                // TODO Auto-generated method stub
                Log.d(TAG, "query the images");
                Cursor cursor = operations.query(Permission.TABLE_NAME, null,
                        Permission.COLUMN_FK_ENTERPRISE_ID + "=? AND " + Permission.COLUMN_TYPE + "=?",
                        new String[] { "" + rowId, "1" });
                Log.d(TAG, "result: " + cursor.getCount());
                return cursor;
            }
        };
    } else if (id == Constants.PERMISSION_FILE_ID) {

    }
    return cursorLoader;
}