Java Code Examples for android.os.Bundle#getBundle()

The following examples show how to use android.os.Bundle#getBundle() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    if (mHavePrefs) {
        bindPreferences();
    }

    mInitDone = true;

    if (savedInstanceState != null) {
        Bundle container = savedInstanceState.getBundle(PREFERENCES_TAG);
        if (container != null) {
            final PreferenceScreen preferenceScreen = getPreferenceScreen();
            if (preferenceScreen != null) {
                preferenceScreen.restoreHierarchyState(container);
            }
        }
    }
}
 
Example 2
Source Project: Phantom   File: ActivityHostProxy.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    savedInstanceState.setClassLoader(mPluginInfo.getPluginClassLoader());
    Set<String> keys = savedInstanceState.keySet();
    for (String key : keys) {
        Bundle internalBundle = savedInstanceState.getBundle(key);
        if (null != internalBundle) {
            internalBundle.setClassLoader(mPluginInfo.getPluginClassLoader());
        }
    }

    try {
        super.onRestoreInstanceState(savedInstanceState);
    } catch (Exception e) {
        VLog.w(e, "super.onRestoreInstanceState() error");
        LogReporter.reportException(e);
    }

    Bundle savedData = getPluginSavedData(savedInstanceState);
    callTargetActivityMethod(ON_RESTORE_INSTANCE_STATE, "onRestoreInstanceState", savedData);
}
 
Example 3
Source Project: FacebookImageShareIntent   File: AppLinkData.java    License: MIT License 6 votes vote down vote up
private static AppLinkData createFromAlApplinkData(Intent intent) {
    Bundle applinks = intent.getBundleExtra(BUNDLE_AL_APPLINK_DATA_KEY);
    if (applinks == null) {
        return null;
    }

    AppLinkData appLinkData = new AppLinkData();
    appLinkData.targetUri = intent.getData();
    if (appLinkData.targetUri == null) {
        String targetUriString = applinks.getString(METHOD_ARGS_TARGET_URL_KEY);
        if (targetUriString != null) {
            appLinkData.targetUri = Uri.parse(targetUriString);
        }
    }
    appLinkData.argumentBundle = applinks;
    appLinkData.arguments = null;
    Bundle refererData = applinks.getBundle(ARGUMENTS_REFERER_DATA_KEY);
    if (refererData != null) {
        appLinkData.ref = refererData.getString(REFERER_DATA_REF_KEY);
    }

    return appLinkData;
}
 
Example 4
public void onCreate(Intent intent, Bundle savedInstanceState, NavigatorView containerView, StackablePath... defaultPaths) {
    Preconditions.checkNotNull(containerView, "Container view cannot not be null");
    Preconditions.checkArgument(defaultPaths != null && defaultPaths.length > 0, "Default path cannot not be null nor empty");

    if (navigator.history.shouldInit()) {
        Bundle bundle = null;
        if (!navigator.config.dontRestoreStackAfterKill) {
            if (intent != null && intent.hasExtra(HISTORY_KEY)) {
                bundle = intent.getBundleExtra(HISTORY_KEY);
            } else if (savedInstanceState != null && savedInstanceState.containsKey(HISTORY_KEY)) {
                bundle = savedInstanceState.getBundle(HISTORY_KEY);
            }
        }

        if (bundle != null) {
            navigator.history.init(bundle);
        } else {
            navigator.history.init(defaultPaths);
        }
    }

    navigator.presenter.attach(containerView);
    navigator.dispatcher.activate();
}
 
Example 5
Source Project: letv   File: NotificationCompat.java    License: Apache License 2.0 6 votes vote down vote up
public WearableExtender(Notification notif) {
    Bundle extras = NotificationCompat.getExtras(notif);
    Bundle wearableBundle = extras != null ? extras.getBundle(EXTRA_WEARABLE_EXTENSIONS) : null;
    if (wearableBundle != null) {
        Action[] actions = NotificationCompat.IMPL.getActionsFromParcelableArrayList(wearableBundle.getParcelableArrayList(KEY_ACTIONS));
        if (actions != null) {
            Collections.addAll(this.mActions, actions);
        }
        this.mFlags = wearableBundle.getInt(KEY_FLAGS, 1);
        this.mDisplayIntent = (PendingIntent) wearableBundle.getParcelable(KEY_DISPLAY_INTENT);
        Notification[] pages = NotificationCompat.getNotificationArrayFromBundle(wearableBundle, KEY_PAGES);
        if (pages != null) {
            Collections.addAll(this.mPages, pages);
        }
        this.mBackground = (Bitmap) wearableBundle.getParcelable(KEY_BACKGROUND);
        this.mContentIcon = wearableBundle.getInt(KEY_CONTENT_ICON);
        this.mContentIconGravity = wearableBundle.getInt(KEY_CONTENT_ICON_GRAVITY, 8388613);
        this.mContentActionIndex = wearableBundle.getInt(KEY_CONTENT_ACTION_INDEX, -1);
        this.mCustomSizePreset = wearableBundle.getInt(KEY_CUSTOM_SIZE_PRESET, 0);
        this.mCustomContentHeight = wearableBundle.getInt(KEY_CUSTOM_CONTENT_HEIGHT);
        this.mGravity = wearableBundle.getInt(KEY_GRAVITY, 80);
        this.mHintScreenTimeout = wearableBundle.getInt(KEY_HINT_SCREEN_TIMEOUT);
    }
}
 
Example 6
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    if (mHavePrefs) {
        bindPreferences();
    }

    mInitDone = true;

    if (savedInstanceState != null) {
        Bundle container = savedInstanceState.getBundle(PREFERENCES_TAG);
        if (container != null) {
            final PreferenceScreen preferenceScreen = getPreferenceScreen();
            if (preferenceScreen != null) {
                preferenceScreen.restoreHierarchyState(container);
            }
        }
    }
}
 
Example 7
@Override
public void onReceive(Context context, final Intent intent) {
    final Bundle extras =  intent.getExtras();
    final String action = intent.getAction();
    if(extras == null) {
        Log.e(THIS_FILE, "No data in intent retrieved for call");
        return;
    }
    if(!SipManager.ACTION_SIP_CALL_LAUNCH.equals(action)) {
        Log.e(THIS_FILE, "Received invalid action " + action);
        return;
    }

    final int accountId = extras.getInt(SipProfile.FIELD_ID, -2);
    final String callee = extras.getString(SipManager.EXTRA_SIP_CALL_TARGET);
    final Bundle options = extras.getBundle(SipManager.EXTRA_SIP_CALL_OPTIONS);
    if(accountId == -2 || callee == null) {
        Log.e(THIS_FILE, "Invalid rewrite " + accountId);
        return;
    }
    
    getExecutor().execute(new SipRunnable() {
        @Override
        protected void doRun() throws SameThreadException {
            pjService.makeCall(callee, accountId, options);
        }
    });
}
 
Example 8
Source Project: Pioneer   File: ActivityRequestState.java    License: Apache License 2.0 5 votes vote down vote up
public void onLoad(Bundle savedInstanceState) {
    if (savedInstanceState != null) {
        Bundle bundle = savedInstanceState.getBundle(SAVED_ACTIVITY_REQUEST_STATE);
        if (bundle != null) {
            requestIntent = bundle.getParcelable(KEY_REQUEST_INTENT);
            requestArgs = bundle.getBundle(KEY_REQUEST_ARGS);
            requestCode = bundle.getInt(KEY_REQUEST_CODE, -1);
        }
    }
}
 
Example 9
Source Project: material-singleinputform   File: Step.java    License: MIT License 5 votes vote down vote up
public void restore(Bundle setupData){
	if(setupData != null){
		Bundle data = setupData.getBundle(key);
		if(data != null){
			this.data = data;
		}
	}
	onRestore();
}
 
Example 10
Source Project: ImageFileSelector   File: ImageCropper.java    License: Apache License 2.0 5 votes vote down vote up
public void onRestoreInstanceState(Bundle savedInstanceState) {
    if (savedInstanceState != null && savedInstanceState.containsKey(IMAGE_CROPPER_BUNDLE)) {
        Bundle bundle = savedInstanceState.getBundle(IMAGE_CROPPER_BUNDLE);
        if (bundle != null) {
            mOutPutX = bundle.getInt("outputX");
            mOutPutY = bundle.getInt("outputY");
            mAspectX = bundle.getInt("aspectX");
            mAspectY = bundle.getInt("aspectY");
            mScale = bundle.getBoolean("scale");
            mOutFile = (File) bundle.getSerializable("outFile");
            mSrcFile = (File) bundle.getSerializable("srcFile");
            mTempFile = (File) bundle.getSerializable("tempFile");
        }
    }
}
 
Example 11
Source Project: kognitivo   File: NativeProtocol.java    License: Apache License 2.0 5 votes vote down vote up
public static Bundle getSuccessResultsFromIntent(Intent resultIntent) {
    int version = getProtocolVersionFromIntent(resultIntent);
    Bundle extras = resultIntent.getExtras();
    if (!isVersionCompatibleWithBucketedIntent(version) || extras == null) {
        return extras;
    }

    return extras.getBundle(EXTRA_PROTOCOL_METHOD_RESULTS);
}
 
Example 12
Source Project: android_9.0.0_r45   File: UsageStats.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public UsageStats createFromParcel(Parcel in) {
    UsageStats stats = new UsageStats();
    stats.mPackageName = in.readString();
    stats.mBeginTimeStamp = in.readLong();
    stats.mEndTimeStamp = in.readLong();
    stats.mLastTimeUsed = in.readLong();
    stats.mTotalTimeInForeground = in.readLong();
    stats.mLaunchCount = in.readInt();
    stats.mAppLaunchCount = in.readInt();
    stats.mLastEvent = in.readInt();
    Bundle allCounts = in.readBundle();
    if (allCounts != null) {
        stats.mChooserCounts = new ArrayMap<>();
        for (String action : allCounts.keySet()) {
            if (!stats.mChooserCounts.containsKey(action)) {
                ArrayMap<String, Integer> newCounts = new ArrayMap<>();
                stats.mChooserCounts.put(action, newCounts);
            }
            Bundle currentCounts = allCounts.getBundle(action);
            if (currentCounts != null) {
                for (String key : currentCounts.keySet()) {
                    int value = currentCounts.getInt(key);
                    if (value > 0) {
                        stats.mChooserCounts.get(action).put(key, value);
                    }
                }
            }
        }
    }
    return stats;
}
 
Example 13
@Override
public void restoreStateParams(Bundle bundle)
{
    currentParams = bundle.getBundle("passview_params");
    if (currentParams != null)
    {
        setParams(currentParams, true);
    }
    String code = bundle.getString("passview_code");
    if (code != null)
    {
        codeField.setText(code);
    }
}
 
Example 14
/**
 * Restore current states from savedInstanceState
 * 
 * @param savedInstanceState
 * @param key
 */
public void restoreStatesFromKey(Bundle savedInstanceState, String key) {
	if (savedInstanceState != null && savedInstanceState.containsKey(key)) {
		Bundle caldroidSavedState = savedInstanceState.getBundle(key);
		setArguments(caldroidSavedState);
	}
}
 
Example 15
Source Project: letv   File: NativeProtocol.java    License: Apache License 2.0 5 votes vote down vote up
public static Bundle getErrorDataFromResultIntent(Intent resultIntent) {
    if (!isErrorResult(resultIntent)) {
        return null;
    }
    Bundle bridgeArgs = getBridgeArgumentsFromIntent(resultIntent);
    if (bridgeArgs != null) {
        return bridgeArgs.getBundle(BRIDGE_ARG_ERROR_BUNDLE);
    }
    return resultIntent.getExtras();
}
 
Example 16
Source Project: Bolts-Android   File: AppLinks.java    License: MIT License 5 votes vote down vote up
/**
 * Gets the App Link extras for an intent, if there is any.
 *
 * @param intent the incoming intent.
 * @return a bundle containing the App Link extras for the intent, or {@code null} if none is
 * specified.
 */
public static Bundle getAppLinkExtras(Intent intent) {
  Bundle appLinkData = getAppLinkData(intent);
  if (appLinkData == null) {
    return null;
  }
  return appLinkData.getBundle(KEY_NAME_EXTRAS);
}
 
Example 17
public static Bundle getSuccessResultsFromIntent(Intent resultIntent) {
    int version = getProtocolVersionFromIntent(resultIntent);
    Bundle extras = resultIntent.getExtras();
    if (!isVersionCompatibleWithBucketedIntent(version) || extras == null) {
        return extras;
    }

    return extras.getBundle(EXTRA_PROTOCOL_METHOD_RESULTS);
}
 
Example 18
Source Project: pychat   File: CordovaInterfaceImpl.java    License: MIT License 4 votes vote down vote up
/**
 * Call this from onCreate() so that any saved startActivityForResult parameters will be restored.
 */
public void restoreInstanceState(Bundle savedInstanceState) {
    initCallbackService = savedInstanceState.getString("callbackService");
    savedPluginState = savedInstanceState.getBundle("plugin");
    activityWasDestroyed = true;
}
 
Example 19
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    extras = savedInstanceState.getBundle("BUY_EXTRAS");
    super.onRestoreInstanceState(savedInstanceState);
}
 
Example 20
/**
 * Call this from onCreate() so that any saved startActivityForResult parameters will be restored.
 */
public void restoreInstanceState(Bundle savedInstanceState) {
    initCallbackService = savedInstanceState.getString("callbackService");
    savedPluginState = savedInstanceState.getBundle("plugin");
    activityWasDestroyed = true;
}