Bundle getLong - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Bundle getLong method.

This code example shows how to use the following methods:getLong, putLong
    assertEquals(2, bundle.size());
  } 
 
  @Test 
  public void testLong() { 
    bundle.putLong("foo", 5);
    assertEquals(5, bundle.getLong("foo"));
    assertEquals(0,bundle.getLong("bar"));
    assertEquals(7, bundle.getLong("bar", 7));
  } 
 
  @Test 
  public void testDouble() { 
    bundle.putDouble("foo", 5);
    assertEquals(Double.valueOf(5), Double.valueOf(bundle.getDouble("foo")));
    assertEquals(Double.valueOf(0),Double.valueOf(bundle.getDouble("bar")));
    assertEquals(Double.valueOf(7), Double.valueOf(bundle.getDouble("bar", 7)));
  } 
 
  @Test 
8
CodeRank
This code example shows how to use the following methods:getLong, putLong
        assertEquals(2, bundle.size());
    } 
 
    @Test 
    public void testLong() { 
        bundle.putLong("foo", 5);
        assertEquals(5, bundle.getLong("foo"));
        assertEquals(0,bundle.getLong("bar"));
        assertEquals(7, bundle.getLong("bar", 7));
    } 
 
    @Test 
    public void testDouble() { 
        bundle.putDouble("foo", 5);
        assertEquals(Double.valueOf(5), Double.valueOf(bundle.getDouble("foo")));
        assertEquals(Double.valueOf(0),Double.valueOf(bundle.getDouble("bar")));
        assertEquals(Double.valueOf(7), Double.valueOf(bundle.getDouble("bar", 7)));
    } 
 
    @Test 
8
CodeRank
This code example shows how to use the following methods:getLong, getParcelable
        forceLoad();
    } 
 
    @Override 
    public NetworkStats loadInBackground() { 
        final NetworkTemplate template = mArgs.getParcelable(KEY_TEMPLATE);
        final long start = mArgs.getLong(KEY_START);
        final long end = mArgs.getLong(KEY_END);
 
        try { 
            return mSession.getSummaryForAllUid(template, start, end, false);
        } catch (RemoteException e) {
            return null; 
        } 
    } 
 
    @Override 
    protected void onStopLoading() { 
        super.onStopLoading(); 
        cancelLoad();
8
CodeRank
This code example shows how to use the following methods:getInt, getLong, getString
 
		mCommandStack.saveState(outState);
	} 
 
	public void restoreState(Bundle inState) {
		mId = inState.getLong("id");
		mNote = inState.getString("note");
		mCreated = inState.getLong("created");
		mState = inState.getInt("state");
		mTime = inState.getLong("time");
		mLastPlayed = inState.getLong("lastPlayed");
		mCells = CellCollection.deserialize(inState.getString("cells"));
 
		mCommandStack = new CommandStack(mCells);
		mCommandStack.restoreState(inState);
 
		validate(); 
	} 
 
 
7
CodeRank
This code example shows how to use the following methods:getLong, getString
 
    @Override 
    public void onReceive(Context context, Intent intent) {
        Bundle extras = intent.getExtras();
        if (extras != null) {
            String accountKey = extras.getString("account_key");
            long postId = extras.getLong("post_id");
            String type = extras.getString("notification_type");
 
            Notifier.saveLastNotificationActioned(context, accountKey, type, postId);
 
        } 
    } 
} 
8
CodeRank
This code example shows how to use the following methods:getInt, getLong
        }); 
    } 
 
    private void processActivityIntent(Bundle bundle) {
        if (bundle != null) {
            final int displayType = bundle.getInt(KEY_DISPLAY_TYPE, DISPLAY_TYPE_NEW_TEMPLATE);
 
            if (displayType == DISPLAY_TYPE_EDIT_TEMPLATE) {
                editingMode = true;
 
                mCurrentTemplateEditingId = bundle.getLong(KEY_TEMPLATE_ID, Long.MIN_VALUE);
 
                if (mCurrentTemplateEditingId == Long.MIN_VALUE) {
                    throw new IllegalArgumentException(
                            "In editing mode you have to pass the message id"); 
                } 
            } 
        } 
    } 
 
6
CodeRank
This code example shows how to use the following methods:getBundle, getLong
		if (savedInstanceState == null)
			return false; 
 
		try { 
 
			Bundle stateBundle = savedInstanceState.getBundle(EXTRA_WEBVIEW_STATE);
			if (stateBundle == null || stateBundle.size() == 0
					|| webViewBridge.restoreState(stateBundle) == null) {
				Log.w(TAG, "failed to restore webview state");
				return false; 
			} 
			if (Build.VERSION.SDK_INT <= 10) {
				Bundle pictureBundle = savedInstanceState
						.getBundle(EXTRA_WEBVIEW_PICTURE);
 
				if (pictureBundle == null) {
					Log.w(TAG, "failed to restore webview picture state.");
					return false; 
				} 
 

7
CodeRank
This code example shows how to use the following methods:getLong
    return extras.getInt(name, defaultValue);
  } 
 
  @Implementation 
  public long getLongExtra(String name, long defaultValue) {
    return extras.getLong(name, defaultValue);
  } 
 
  @Implementation 
  public double getDoubleExtra(String name, double defaultValue) {
    return extras.getDouble(name, defaultValue);
  } 
 
  @Implementation 
  public Bundle getBundleExtra(String name) {
    return extras.getBundle(name);
  } 
 
  @Implementation 
  public float getFloatExtra(String name, float defaultValue) {
6
CodeRank
This code example shows how to use the following methods:getLong
        return extras.getInt(name, defaultValue);
    } 
 
    @Implementation 
    public long getLongExtra(String name, long defaultValue) {
        return extras.getLong(name, defaultValue);
    } 
 
    @Implementation 
    public double getDoubleExtra(String name, double defaultValue) {
        return extras.getDouble(name, defaultValue);
    } 
 
    @Implementation 
    public Bundle getBundleExtra(String name) {
        return extras.getBundle(name);
    } 
 
    @Implementation 
    public float getFloatExtra(String name, float defaultValue) {
6
CodeRank
This code example shows how to use the following methods:getBoolean, getFloat, getLong, getParcelable
	} 
 
	@Override 
	protected void onRestoreInstanceState(final Parcelable state) {
		final Bundle bundle = (Bundle) state;
		final Parcelable superState = bundle.getParcelable("superState");
		super.onRestoreInstanceState(superState);
 
		mNeedleInitialized = bundle.getBoolean("needleInitialized");
		mNeedleVelocity = bundle.getFloat("needleVelocity");
		mNeedleAcceleration = bundle.getFloat("needleAcceleration");
		mNeedleLastMoved = bundle.getLong("needleLastMoved");
		mCurrentValue = bundle.getFloat("currentValue");
		mTargetValue = bundle.getFloat("targetValue");
	} 
 
	private void initScale() { 
		mScaleRotation = (mScaleStartAngle + 180) % 360;
		mDivisionValue = (mScaleEndValue - mScaleStartValue) / mDivisions;
		mSubdivisionValue = mDivisionValue / mSubdivisions;
6
CodeRank

Related Bundle getLong Questions & Answers:

getLong Method Overview
Returns the value associated with the given key, or 0L if no mapping of the desired type exists for the given key.
See Code Examples for other Android Bundle Methods: