本文整理汇总了Java中android.os.Bundle.putBundle方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.putBundle方法的具体用法?Java Bundle.putBundle怎么用?Java Bundle.putBundle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Bundle
的用法示例。
在下文中一共展示了Bundle.putBundle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: e
import android.os.Bundle; //导入方法依赖的package包/类
public Bundle e() {
Bundle bundle = new Bundle();
bundle.putString("ext_ele_name", this.a);
bundle.putString("ext_ns", this.b);
bundle.putString("ext_text", this.e);
Bundle bundle2 = new Bundle();
if (this.c != null && this.c.length > 0) {
for (int i = 0; i < this.c.length; i++) {
bundle2.putString(this.c[i], this.d[i]);
}
}
bundle.putBundle("attributes", bundle2);
if (this.f != null && this.f.size() > 0) {
bundle.putParcelableArray("children", a(this.f));
}
return bundle;
}
示例2: newInstance
import android.os.Bundle; //导入方法依赖的package包/类
public static UserListDialogFragment newInstance(Stack<syncPlayClientInterface.userFileDetails> users) {
final UserListDialogFragment fragment = new UserListDialogFragment();
final Bundle args = new Bundle();
if(users != null && users.size() > 0) {
for (int i = 0; i < users.size(); i++) { //
try {
Bundle user = new Bundle();
user.putString("username", users.get(i).getUsername());
user.putLong("duration", users.get(i).getDuration());
user.putLong("size", users.get(i).getSize());
user.putString("filename", users.get(i).getFilename());
args.putBundle(String.valueOf(i), user);
} catch (ArrayIndexOutOfBoundsException outOfBounds) {
//
}
}
args.putInt(ARG_ITEM_COUNT, users.size());
fragment.setArguments(args);
} else {
args.putInt(ARG_ITEM_COUNT, 1);
fragment.setArguments(args);
}
return fragment;
}
示例3: onSaveInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (this.mDialog != null) {
Bundle dialogState = this.mDialog.onSaveInstanceState();
if (dialogState != null) {
outState.putBundle(SAVED_DIALOG_STATE_TAG, dialogState);
}
}
if (this.mStyle != 0) {
outState.putInt(SAVED_STYLE, this.mStyle);
}
if (this.mTheme != 0) {
outState.putInt(SAVED_THEME, this.mTheme);
}
if (!this.mCancelable) {
outState.putBoolean(SAVED_CANCELABLE, this.mCancelable);
}
if (!this.mShowsDialog) {
outState.putBoolean(SAVED_SHOWS_DIALOG, this.mShowsDialog);
}
if (this.mBackStackId != -1) {
outState.putInt(SAVED_BACK_STACK_ID, this.mBackStackId);
}
}
示例4: onSaveInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
public Bundle onSaveInstanceState() {
Bundle state = new Bundle();
for (CordovaPlugin plugin : this.pluginMap.values()) {
if (plugin != null) {
Bundle pluginState = plugin.onSaveInstanceState();
if(pluginState != null) {
state.putBundle(plugin.getServiceName(), pluginState);
}
}
}
return state;
}
示例5: serializeBleScanResult
import android.os.Bundle; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public Bundle serializeBleScanResult(android.bluetooth.le.ScanResult scanResult) {
Bundle result = new Bundle();
result.putBundle("Device", serializeBluetoothDevice(scanResult.getDevice()));
result.putInt("Rssi", scanResult.getRssi());
result.putBundle("ScanRecord", serializeBleScanRecord(scanResult.getScanRecord()));
result.putLong("TimestampNanos", scanResult.getTimestampNanos());
return result;
}
示例6: onSaveInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
/**
* {@link android.app.Activity#onSaveInstanceState(Bundle)}, {@link android.app.Fragment#onSaveInstanceState(Bundle)}, {@link android.view.View#onSaveInstanceState()}.
*/
public Bundle onSaveInstanceState() {
Bundle bundle = new Bundle();
getPresenter();
if (presenter != null) {
Bundle presenterBundle = new Bundle();
presenter.save(presenterBundle);
bundle.putBundle(PRESENTER_KEY, presenterBundle);
bundle.putString(PRESENTER_ID_KEY, PresenterStorage.INSTANCE.getId(presenter));
}
return bundle;
}
示例7: setToolbarItem
import android.os.Bundle; //导入方法依赖的package包/类
public boolean setToolbarItem(int id, @NonNull Bitmap icon, @NonNull String description) {
Bundle bundle = new Bundle();
bundle.putInt("android.support.customtabs.customaction.ID", id);
bundle.putParcelable("android.support.customtabs.customaction.ICON", icon);
bundle.putString("android.support.customtabs.customaction.DESCRIPTION", description);
Bundle metaBundle = new Bundle();
metaBundle.putBundle("android.support.customtabs.extra.ACTION_BUTTON_BUNDLE", bundle);
try {
return this.mService.updateVisuals(this.mCallback, metaBundle);
} catch (RemoteException var7) {
return false;
}
}
示例8: save
import android.os.Bundle; //导入方法依赖的package包/类
public Bundle save() {
Bundle bundle = new Bundle();
for (QuizPage page : getCurrentPageSequence()) {
bundle.putBundle(page.getKey(), page.getData());
}
return bundle;
}
示例9: saveManagedDialogs
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Save the state of any managed dialogs.
*
* @param outState place to store the saved state.
*/
private void saveManagedDialogs(Bundle outState) {
if (mManagedDialogs == null) {
return;
}
final int numDialogs = mManagedDialogs.size();
if (numDialogs == 0) {
return;
}
Bundle dialogState = new Bundle();
int[] ids = new int[mManagedDialogs.size()];
// save each dialog's bundle, gather the ids
for (int i = 0; i < numDialogs; i++) {
final int key = mManagedDialogs.keyAt(i);
ids[i] = key;
final ManagedDialog md = mManagedDialogs.valueAt(i);
dialogState.putBundle(savedDialogKeyFor(key), md.mDialog.onSaveInstanceState());
if (md.mArgs != null) {
dialogState.putBundle(savedDialogArgsKeyFor(key), md.mArgs);
}
}
dialogState.putIntArray(SAVED_DIALOG_IDS_KEY, ids);
outState.putBundle(SAVED_DIALOGS_TAG, dialogState);
}
示例10: toBundle
import android.os.Bundle; //导入方法依赖的package包/类
private static Bundle toBundle(JSONObject node) throws JSONException {
Bundle bundle = new Bundle();
@SuppressWarnings("unchecked")
Iterator<String> fields = node.keys();
while (fields.hasNext()) {
String key = fields.next();
Object value;
value = node.get(key);
if (value instanceof JSONObject) {
bundle.putBundle(key, toBundle((JSONObject) value));
} else if (value instanceof JSONArray) {
JSONArray valueArr = (JSONArray) value;
if (valueArr.length() == 0) {
bundle.putStringArray(key, new String[0]);
} else {
Object firstNode = valueArr.get(0);
if (firstNode instanceof JSONObject) {
Bundle[] bundles = new Bundle[valueArr.length()];
for (int i = 0; i < valueArr.length(); i++) {
bundles[i] = toBundle(valueArr.getJSONObject(i));
}
bundle.putParcelableArray(key, bundles);
} else if (firstNode instanceof JSONArray) {
// we don't support nested arrays
throw new FacebookException("Nested arrays are not supported.");
} else { // just use the string value
String[] arrValues = new String[valueArr.length()];
for (int i = 0; i < valueArr.length(); i++) {
arrValues[i] = valueArr.get(i).toString();
}
bundle.putStringArray(key, arrValues);
}
}
} else {
bundle.putString(key, value.toString());
}
}
return bundle;
}
示例11: onSaveInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Saves parameters for startActivityForResult().
*/
public void onSaveInstanceState(Bundle outState) {
if (activityResultCallback != null) {
String serviceName = activityResultCallback.getServiceName();
outState.putString("callbackService", serviceName);
}
if(pluginManager != null){
outState.putBundle("plugin", pluginManager.onSaveInstanceState());
}
}
示例12: convertToBundle
import android.os.Bundle; //导入方法依赖的package包/类
public static Bundle convertToBundle(JSONObject jsonObject) throws JSONException {
Bundle bundle = new Bundle();
@SuppressWarnings("unchecked")
Iterator<String> jsonIterator = jsonObject.keys();
while (jsonIterator.hasNext()) {
String key = jsonIterator.next();
Object value = jsonObject.get(key);
if (value == null || value == JSONObject.NULL) {
// Null is not supported.
continue;
}
// Special case JSONObject as it's one way, on the return it would be Bundle.
if (value instanceof JSONObject) {
bundle.putBundle(key, convertToBundle((JSONObject)value));
continue;
}
Setter setter = SETTERS.get(value.getClass());
if (setter == null) {
throw new IllegalArgumentException("Unsupported type: " + value.getClass());
}
setter.setOnBundle(bundle, key, value);
}
return bundle;
}
示例13: getInstance
import android.os.Bundle; //导入方法依赖的package包/类
public static SimpleOneLinerDialog getInstance(
int id,
@StringRes int title,
@StringRes int hint,
@StringRes int positiveButtonText,
@StringRes int negativeButtonText,
String defaultValue,
Bundle userData) {
SimpleOneLinerDialog dialog = new SimpleOneLinerDialog();
Bundle args = new Bundle();
args.putInt(ARG_TITLE, title);
if (hint != 0) {
args.putInt(ARG_HINT, hint);
}
if (defaultValue != null) {
args.putString(ARG_VALUE, defaultValue);
}
args.putInt(ARG_ID, id);
if (userData != null) {
args.putBundle(ARG_USER_DATA, userData);
}
args.putInt(ARG_POSITIVE_BUTTON_TEXT, positiveButtonText);
args.putInt(ARG_NEGATIVE_BUTTON_TEXT, negativeButtonText);
dialog.setArguments(args);
return dialog;
}
示例14: toBundle
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Convert a {@link WritableMap} to a {@link Bundle}.
* @param readableMap the {@link WritableMap} to convert.
* @return the converted {@link Bundle}.
*/
@Nullable
public static Bundle toBundle(@Nullable ReadableMap readableMap) {
if (readableMap == null) {
return null;
}
ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
Bundle bundle = new Bundle();
while (iterator.hasNextKey()) {
String key = iterator.nextKey();
ReadableType readableType = readableMap.getType(key);
switch (readableType) {
case Null:
bundle.putString(key, null);
break;
case Boolean:
bundle.putBoolean(key, readableMap.getBoolean(key));
break;
case Number:
// Can be int or double.
bundle.putDouble(key, readableMap.getDouble(key));
break;
case String:
bundle.putString(key, readableMap.getString(key));
break;
case Map:
bundle.putBundle(key, toBundle(readableMap.getMap(key)));
break;
case Array:
// TODO t8873322
throw new UnsupportedOperationException("Arrays aren't supported yet.");
default:
throw new IllegalArgumentException("Could not convert object with key: " + key + ".");
}
}
return bundle;
}
示例15: save
import android.os.Bundle; //导入方法依赖的package包/类
public void save(final @NonNull TfcBaseActivityPresenter activityPresenter,
final @NonNull Bundle envelope) {
envelope.putString(PRESENTER_ID_KEY, findIdForPresenter(activityPresenter));
final Bundle state = new Bundle();
envelope.putBundle(PRESENTER_STATE_KEY, state);
}