android.os.Bundle#getBundle ( )源码实例Demo

下面列出了android.os.Bundle#getBundle ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@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);
            }
        }
    }
}
 
源代码2 项目: Phantom   文件: ActivityHostProxy.java
@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);
}
 
源代码3 项目: FacebookImageShareIntent   文件: AppLinkData.java
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;
}
 
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();
}
 
源代码5 项目: letv   文件: NotificationCompat.java
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);
    }
}
 
源代码6 项目: ticdesign   文件: PreferenceFragmentCompat.java
@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);
            }
        }
    }
}
 
源代码7 项目: CSipSimple   文件: SipService.java
@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);
        }
    });
}
 
源代码8 项目: Pioneer   文件: ActivityRequestState.java
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);
        }
    }
}
 
源代码9 项目: material-singleinputform   文件: Step.java
public void restore(Bundle setupData){
	if(setupData != null){
		Bundle data = setupData.getBundle(key);
		if(data != null){
			this.data = data;
		}
	}
	onRestore();
}
 
源代码10 项目: ImageFileSelector   文件: ImageCropper.java
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");
        }
    }
}
 
源代码11 项目: kognitivo   文件: NativeProtocol.java
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);
}
 
源代码12 项目: android_9.0.0_r45   文件: UsageStats.java
@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;
}
 
源代码13 项目: TelePlus-Android   文件: LoginActivity.java
@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);
    }
}
 
源代码14 项目: iSCAU-Android   文件: CaldroidFragment.java
/**
 * 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);
	}
}
 
源代码15 项目: letv   文件: NativeProtocol.java
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();
}
 
源代码16 项目: Bolts-Android   文件: AppLinks.java
/**
 * 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);
}
 
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);
}
 
源代码18 项目: pychat   文件: CordovaInterfaceImpl.java
/**
 * 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;
}
 
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    extras = savedInstanceState.getBundle("BUY_EXTRAS");
    super.onRestoreInstanceState(savedInstanceState);
}
 
/**
 * 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;
}