本文整理汇总了Java中android.os.Bundle.putAll方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.putAll方法的具体用法?Java Bundle.putAll怎么用?Java Bundle.putAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Bundle
的用法示例。
在下文中一共展示了Bundle.putAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addAccount
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Asks the user to add an account of a specified type. The authenticator
* for this account type processes this request with the appropriate user
* interface. If the user does elect to create a new account, the account
* name is returned.
* <p>
* <p>This method may be called from any thread, but the returned
* {@link AccountManagerFuture} must not be used on the main thread.
* <p>
*
*/
public AccountManagerFuture<Bundle> addAccount(final int userId, final String accountType,
final String authTokenType, final String[] requiredFeatures,
final Bundle addAccountOptions,
final Activity activity, AccountManagerCallback<Bundle> callback, Handler handler) {
if (accountType == null) throw new IllegalArgumentException("accountType is null");
final Bundle optionsIn = new Bundle();
if (addAccountOptions != null) {
optionsIn.putAll(addAccountOptions);
}
optionsIn.putString(KEY_ANDROID_PACKAGE_NAME, "android");
return new AmsTask(activity, handler, callback) {
@Override
public void doWork() throws RemoteException {
addAccount(userId, mResponse, accountType, authTokenType,
requiredFeatures, activity != null, optionsIn);
}
}.start();
}
示例2: intentToFragmentArguments
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Converts an intent and a {@link Bundle} into a {@link Bundle} suitable for use as fragment arguments.
*/
public static Bundle intentToFragmentArguments(Intent intent, Bundle extras) {
Bundle arguments = new Bundle();
if (intent == null) {
return arguments;
}
final Uri data = intent.getData();
if (data != null) {
arguments.putParcelable("_uri", data);
}
if (extras != null) {
arguments.putAll(intent.getExtras());
}
return arguments;
}
示例3: valueSizes
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Measure the sizes of all the values in a typed {@link Bundle} when written to a
* {@link Parcel}. Returns a map from keys to the sizes, in bytes, of the associated values in
* the Bundle.
*
* @param bundle to measure
* @return a map from keys to value sizes in bytes
*/
public static Map<String, Integer> valueSizes(@NonNull Bundle bundle) {
Map<String, Integer> result = new HashMap<>(bundle.size());
// We measure the size of each value by measuring the total size of the bundle before and
// after removing that value and calculating the difference. We make a copy of the original
// bundle so we can put all the original values back at the end. It's not possible to
// carry out the measurements on the copy because of the way Android parcelables work
// under the hood where certain objects are actually stored as references.
Bundle copy = new Bundle(bundle);
try {
int bundleSize = sizeAsParcel(bundle);
// Iterate over copy's keys because we're removing those of the original bundle
for (String key : copy.keySet()) {
bundle.remove(key);
int newBundleSize = sizeAsParcel(bundle);
int valueSize = bundleSize - newBundleSize;
result.put(key, valueSize);
bundleSize = newBundleSize;
}
return result;
} finally {
// Put everything back into original bundle
bundle.putAll(copy);
}
}
示例4: b
import android.os.Bundle; //导入方法依赖的package包/类
private Bundle b(String str) {
Bundle bundle = new Bundle();
bundle.putString("pkgName", Global.getContext().getPackageName());
if (!(TO_APPBAR_DETAIL.equals(str) || TO_APPBAR_SEND_BLOG.equals(str))) {
if (TO_APPBAR_NEWS.equals(str)) {
bundle.putString("source", "myapp");
} else if ("sId".equals(str)) {
if (this.a != null) {
bundle.putAll(this.a);
}
} else if ("toThread".equals(str)) {
str = String.format("sId/t/%s", new Object[]{this.b});
}
}
bundle.putString("route", str);
return bundle;
}
示例5: build
import android.os.Bundle; //导入方法依赖的package包/类
public Notification build() {
Notification notif = this.b.build();
Bundle extras = NotificationCompatJellybean.getExtras(notif);
Bundle mergeBundle = new Bundle(this.mExtras);
for (String key : this.mExtras.keySet()) {
if (extras.containsKey(key)) {
mergeBundle.remove(key);
}
}
extras.putAll(mergeBundle);
SparseArray<Bundle> actionExtrasMap = NotificationCompatJellybean.buildActionExtrasMap(this.mActionExtrasList);
if (actionExtrasMap != null) {
NotificationCompatJellybean.getExtras(notif).putSparseParcelableArray("android.support.actionExtras", actionExtrasMap);
}
return notif;
}
示例6: getParameters
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public Bundle getParameters() {
Bundle parameters = new Bundle();
if (uploadContext.params != null) {
parameters.putAll(uploadContext.params);
}
parameters.putString(PARAM_UPLOAD_PHASE, PARAM_VALUE_UPLOAD_FINISH_PHASE);
parameters.putString(PARAM_SESSION_ID, uploadContext.sessionId);
Utility.putNonEmptyString(parameters, PARAM_TITLE, uploadContext.title);
Utility.putNonEmptyString(parameters, PARAM_DESCRIPTION, uploadContext.description);
Utility.putNonEmptyString(parameters, PARAM_REF, uploadContext.ref);
return parameters;
}
示例7: parseUrl
import android.os.Bundle; //导入方法依赖的package包/类
public static Bundle parseUrl(String str) {
try {
URL url = new URL(str);
Bundle decodeUrl = decodeUrl(url.getQuery());
decodeUrl.putAll(decodeUrl(url.getRef()));
return decodeUrl;
} catch (MalformedURLException e) {
return new Bundle();
}
}
示例8: parseUrl
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Parse a URL query and fragment parameters into a key-value bundle.
*
* @param url the URL to parse
* @return a dictionary bundle of keys and values
*/
@Deprecated
public static Bundle parseUrl(String url) {
// hack to prevent MalformedURLException
url = url.replace("fbconnect", "http");
try {
URL u = new URL(url);
Bundle b = decodeUrl(u.getQuery());
b.putAll(decodeUrl(u.getRef()));
return b;
} catch (MalformedURLException e) {
return new Bundle();
}
}
示例9: sync
import android.os.Bundle; //导入方法依赖的package包/类
public void sync(Bundle data) {
AccountManager manager = (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE);
Account[] accounts = manager.getAccountsByType(context.getString(R.string.auth_type));
if (accounts.length > 0) {
Bundle settings = new Bundle();
settings.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
settings.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
settings.putString(SyncAdapter.KEY_SYNC_MODEL, model.getModelName());
if (data != null)
settings.putAll(data);
ContentResolver.requestSync(accounts[0], model.getAuthority(), settings);
}
}
示例10: challenge
import android.os.Bundle; //导入方法依赖的package包/类
public void challenge(Activity activity, Bundle bundle, IUiListener iUiListener) {
this.b = activity;
Intent agentIntentWithTarget = getAgentIntentWithTarget(SocialConstants.ACTIVITY_CHALLENGE);
bundle.putAll(composeActivityParams());
Activity activity2 = activity;
a(activity2, agentIntentWithTarget, SocialConstants.ACTION_CHALLENGE, bundle, ServerSetting.getInstance().getEnvUrl(Global.getContext(), ServerSetting.DEFAULT_URL_BRAG), iUiListener, false);
}
示例11: RunAndGetDeterminantWithAdjoint
import android.os.Bundle; //导入方法依赖的package包/类
public void RunAndGetDeterminantWithAdjoint(final int i, final ProgressDialog progressDialog) {
Runnable runnable = new Runnable() {
@Override
public void run() {
Message message = new Message();
Bundle bundle = new Bundle();
float detr = (float) SquareList.get(i).GetDeterminant(progressDialog);
if (detr == 0.0f) {
myHandler.postDelayed(new Runnable() {
@Override
public void run() {
Toast.makeText(getContext(), R.string.NoInverse, Toast.LENGTH_SHORT).show();
}
}, 0);
progressDialog.dismiss();
} else {
progressDialog.setProgress(0);
bundle.putFloat("DETERMINANT", detr);
Matrix res = SquareList.get(i).ReturnAdjoint(progressDialog);
bundle.putAll(res.GetDataBundled());
message.setData(bundle);
myHandler.sendMessage(message);
}
}
};
Thread thread = new Thread(runnable);
thread.start();
}
示例12: a
import android.os.Bundle; //导入方法依赖的package包/类
public void a(Bundle bundle) {
super.a(bundle);
bundle.putAll(a.a(this.a));
bundle.putInt("_wxapi_sendmessagetowx_req_scene", this.b);
}
示例13: toBundle
import android.os.Bundle; //导入方法依赖的package包/类
public void toBundle(Bundle bundle) {
super.toBundle(bundle);
bundle.putAll(Builder.toBundle(this.message));
}
示例14: b
import android.os.Bundle; //导入方法依赖的package包/类
public void b(Bundle bundle) {
super.b(bundle);
bundle.putAll(a.a(this.a));
}
示例15: onSaveInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putAll(mFreProperties);
}