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

The following are Jave code examples for showing how to use getBundle() of the android.os.Bundle class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: AndroidBackendlessChat   File: AppLinkData.java   View Source Code Vote up 8 votes
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 2
Project: chat-sdk-android-push-firebase   File: AppLinkData.java   View Source Code Vote up 6 votes
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 3
Project: kognitivo   File: AppLinkData.java   View Source Code Vote up 6 votes
/**
 * Parses out any app link data from the Intent passed in.
 * @param intent Intent from the Activity that started because of an app link
 * @return AppLinkData if found. null if not.
 */
public 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
Project: puremadrid   File: MyMapFragment.java   View Source Code Vote up 6 votes
@Override
public void onCreate(Bundle savedInstanceState) {
    final Bundle mapViewSavedInstanceState = savedInstanceState != null ? savedInstanceState.getBundle(KEY_MAPVIEW_SAVE_INSTANCE) : null;
    super.onCreate(mapViewSavedInstanceState);

    // Load last measure
    mCallbacks = new DataBaseLoader(getActivity(),this);
    if (mMapView != null) {
        mMapView.onCreate(savedInstanceState);
    }

    if (savedInstanceState != null) {
        showHeatMap = savedInstanceState.getBoolean(KEY_SHOW_HEATMAP);
        showStations = savedInstanceState.getBoolean(KEY_SHOW_STATIONS);
    }
}
 
Example 5
Project: boohee_v5.6   File: d.java   View Source Code Vote up 6 votes
public d(Bundle bundle) {
    this.h = bundle.getString("ext_to");
    this.i = bundle.getString("ext_from");
    this.j = bundle.getString("ext_chid");
    this.g = bundle.getString("ext_pkt_id");
    Parcelable[] parcelableArray = bundle.getParcelableArray("ext_exts");
    if (parcelableArray != null) {
        this.l = new ArrayList(parcelableArray.length);
        for (Parcelable parcelable : parcelableArray) {
            a a = a.a((Bundle) parcelable);
            if (a != null) {
                this.l.add(a);
            }
        }
    }
    Bundle bundle2 = bundle.getBundle("ext_ERROR");
    if (bundle2 != null) {
        this.n = new h(bundle2);
    }
}
 
Example 6
Project: airgram   File: LoginActivity.java   View Source Code Vote up 6 votes
@Override
public void restoreStateParams(Bundle bundle) {
    currentParams = bundle.getBundle("smsview_params_" + currentType);
    if (currentParams != null) {
        setParams(currentParams);
    }
    String code = bundle.getString("smsview_code_" + currentType);
    if (code != null) {
        codeField.setText(code);
    }
    int t = bundle.getInt("time");
    if (t != 0) {
        time = t;
    }
    int t2 = bundle.getInt("open");
    if (t2 != 0) {
        openTime = t2;
    }
}
 
Example 7
Project: flowr   File: Flowr.java   View Source Code Vote up 6 votes
/**
 * Build and return a new ResultResponse instant using the arguments passed in.
 *
 * @param arguments  Used to retrieve the ID and request code for the fragment
 *                   requesting the results.
 * @param resultCode The results code to be returned.
 * @param data       Used to return extra data that might be required.
 * @return a new {@link ResultResponse} instance
 */
public static ResultResponse getResultsResponse(Bundle arguments, int resultCode, Bundle data) {
    if (arguments == null || !arguments.containsKey(KEY_REQUEST_BUNDLE)) {
        return null;
    }

    ResultResponse resultResponse = new ResultResponse();
    resultResponse.resultCode = resultCode;
    resultResponse.data = data;

    Bundle requestBundle = arguments.getBundle(KEY_REQUEST_BUNDLE);

    if (requestBundle != null) {
        resultResponse.fragmentId = requestBundle.getString(KEY_FRAGMENT_ID);
        resultResponse.requestCode = requestBundle.getInt(KEY_REQUEST_CODE);
    }

    return resultResponse;
}
 
Example 8
Project: USay   File: WebViewFenLeiActivity.java   View Source Code Vote up 5 votes
private void initData() {
    Intent intent = getIntent();
    Bundle bundle = intent.getExtras();
    if (bundle != null) {
        Bundle data = bundle.getBundle("extra");
        if (data != null) {
            author = data.getString("author");
            url = data.getString("url");
            images = data.getStringArrayList("images");
            newid = data.getString("new_id");
            title = data.getString("title");
        }
    }
}
 
Example 9
Project: recyclerview-android   File: SingleChoiceMode.java   View Source Code Vote up 5 votes
public SingleChoiceMode(@Nullable final Bundle savedInstanceState) {
    super();
    final Bundle state = (savedInstanceState != null ?
            savedInstanceState.getBundle(KEY_SINGLE_CHOICE_MODE) : null);
    if (state != null) {
        mCheckedId = state.getLong(KEY_CHECKED_ID, RecyclerView.NO_ID);
    }
}
 
Example 10
Project: kognitivo   File: NativeProtocol.java   View Source Code Vote up 5 votes
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 11
Project: PlusGram   File: LoginActivity.java   View Source Code Vote up 5 votes
@Override
public void restoreStateParams(Bundle bundle) {
    currentParams = bundle.getBundle("passview_params");
    if (currentParams != null) {
        setParams(currentParams);
    }
    String code = bundle.getString("passview_code");
    if (code != null) {
        codeField.setText(code);
    }
}
 
Example 12
Project: ProgressManager   File: a.java   View Source Code Vote up 5 votes
/**
 * Restore the state of any saved managed dialogs.
 *
 * @param savedInstanceState The bundle to restore from.
 */
private void restoreManagedDialogs(Bundle savedInstanceState) {
    final Bundle b = savedInstanceState.getBundle(SAVED_DIALOGS_TAG);
    if (b == null) {
        return;
    }

    final int[] ids = b.getIntArray(SAVED_DIALOG_IDS_KEY);
    final int numDialogs = ids.length;
    mManagedDialogs = new SparseArray<ManagedDialog>(numDialogs);
    for (int i = 0; i < numDialogs; i++) {
        final Integer dialogId = ids[i];
        Bundle dialogState = b.getBundle(savedDialogKeyFor(dialogId));
        if (dialogState != null) {
            // Calling onRestoreInstanceState() below will invoke dispatchOnCreate
            // so tell createDialog() not to do it, otherwise we get an exception
            final ManagedDialog md = new ManagedDialog();
            md.mArgs = b.getBundle(savedDialogArgsKeyFor(dialogId));
            md.mDialog = createDialog(dialogId, dialogState, md.mArgs);
            if (md.mDialog != null) {
                mManagedDialogs.put(dialogId, md);
                onPrepareDialog(dialogId, md.mDialog, md.mArgs);
                md.mDialog.onRestoreInstanceState(dialogState);
            }
        }
    }
}
 
Example 13
Project: USay   File: WebViewActivity.java   View Source Code Vote up 5 votes
private void initData() {
    Intent intent = getIntent();
    Bundle bundle = intent.getExtras();
    if (bundle != null) {
        Bundle data = bundle.getBundle("data");
        if (data != null) {
            authorId = data.getString("authorId");
            imgHeadLink = data.getString("imgHeadLink");
            contentUrl = data.getString("contentUrl");
            Log.d("contentUrl", contentUrl);
        }
    }
}
 
Example 14
Project: ProgressManager   File: a.java   View Source Code Vote up 5 votes
/**
 * Restore the state of any saved managed dialogs.
 *
 * @param savedInstanceState The bundle to restore from.
 */
private void restoreManagedDialogs(Bundle savedInstanceState) {
    final Bundle b = savedInstanceState.getBundle(SAVED_DIALOGS_TAG);
    if (b == null) {
        return;
    }

    final int[] ids = b.getIntArray(SAVED_DIALOG_IDS_KEY);
    final int numDialogs = ids.length;
    mManagedDialogs = new SparseArray<ManagedDialog>(numDialogs);
    for (int i = 0; i < numDialogs; i++) {
        final Integer dialogId = ids[i];
        Bundle dialogState = b.getBundle(savedDialogKeyFor(dialogId));
        if (dialogState != null) {
            // Calling onRestoreInstanceState() below will invoke dispatchOnCreate
            // so tell createDialog() not to do it, otherwise we get an exception
            final ManagedDialog md = new ManagedDialog();
            md.mArgs = b.getBundle(savedDialogArgsKeyFor(dialogId));
            md.mDialog = createDialog(dialogId, dialogState, md.mArgs);
            if (md.mDialog != null) {
                mManagedDialogs.put(dialogId, md);
                onPrepareDialog(dialogId, md.mDialog, md.mArgs);
                md.mDialog.onRestoreInstanceState(dialogState);
            }
        }
    }
}
 
Example 15
Project: Lyra   File: DefaultGsonCoder.java   View Source Code Vote up 5 votes
/**
 * Read a field's value from the saved state {@link Bundle}.
 *
 * @param state {@link Bundle} used to save the state
 * @param key   key retrieved from {@code fieldDeclaringClass#fieldName}
 * @return value of the field
 */
@SuppressWarnings("ConstantConditions")
@Override
public FieldType deserialize(@NonNull Bundle state, @NonNull String key) {
    Bundle bundle = state.getBundle(key);
    if (bundle == null)
        return null;

    Class jsonClass = (Class) bundle.getSerializable(CLASS_KEY);
    String jsonString = bundle.getString(VALUE_KEY);
    //noinspection unchecked
    return (FieldType) gson().fromJson(jsonString, jsonClass);
}
 
Example 16
Project: keemob   File: CordovaInterfaceImpl.java   View Source Code Vote up 4 votes
/**
 * 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 17
Project: android-state   File: InjectionHelper.java   View Source Code Vote up 4 votes
public Bundle getBundle(Bundle state, String key) {
    return state.getBundle(key + mBaseKey);
}
 
Example 18
Project: cordova-vuetify   File: CordovaInterfaceImpl.java   View Source Code Vote up 4 votes
/**
 * 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
Project: WearVibrationCenter   File: NotificationUtils.java   View Source Code Vote up 4 votes
@SuppressWarnings("ConstantConditions")
public static Bitmap getNotificationBackgroundImage(Context context, StatusBarNotification notification) {
    Bundle extras = NotificationCompat.getExtras(notification.getNotification());
    if (extras != null) {
        //Extract image from BigPictureStyle notification style
        Bitmap bitmap = BitmapUtils.getBitmap(context, extras.getParcelable(NotificationCompat.EXTRA_PICTURE));
        if (bitmap != null) {
            return bitmap;
        }

        //Extract image from Wearable extender background
        if (extras.containsKey("android.wearable.EXTENSIONS")) {
            Bundle wearableExtension = extras.getBundle("android.wearable.EXTENSIONS");
            bitmap = BitmapUtils.getBitmap(context, wearableExtension.getParcelable("background"));
            if (bitmap != null) {
                return bitmap;
            }
        }

        //Extract image from Car extender large icon
        if (extras.containsKey("android.car.EXTENSIONS")) {
            Bundle carExtensions = extras.getBundle("android.car.EXTENSIONS");
            bitmap = BitmapUtils.getBitmap(context, carExtensions.getParcelable("large_icon"));
            if (bitmap != null) {
                return bitmap;
            }
        }

        //Extract image from large icon on android notification
        bitmap = BitmapUtils.getBitmap(context, extras.getParcelable(NotificationCompat.EXTRA_LARGE_ICON_BIG));
        if (bitmap != null) {
            return bitmap;
        }

        bitmap = BitmapUtils.getBitmap(context, extras.getParcelable(NotificationCompat.EXTRA_LARGE_ICON));
        if (bitmap != null) {
            return bitmap;
        }
    }

    return null;
}
 
Example 20
Project: ProgressManager   File: a.java   View Source Code Vote up 3 votes
/**
 * This method is called after {@link #onStart} when the activity is
 * being re-initialized from a previously saved state, given here in
 * <var>savedInstanceState</var>.  Most implementations will simply use {@link #onCreate}
 * to restore their state, but it is sometimes convenient to do it here
 * after all of the initialization has been done or to allow subclasses to
 * decide whether to use your default implementation.  The default
 * implementation of this method performs a restore of any view state that
 * had previously been frozen by {@link #onSaveInstanceState}.
 *
 * <p>This method is called between {@link #onStart} and
 * {@link #onPostCreate}.
 *
 * @param savedInstanceState the data most recently supplied in {@link #onSaveInstanceState}.
 *
 * @see #onCreate
 * @see #onPostCreate
 * @see #onResume
 * @see #onSaveInstanceState
 */
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    if (mWindow != null) {
        Bundle windowState = savedInstanceState.getBundle(WINDOW_HIERARCHY_TAG);
        if (windowState != null) {
            mWindow.restoreHierarchyState(windowState);
        }
    }
}