本文整理汇总了Java中android.os.Bundle.remove方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.remove方法的具体用法?Java Bundle.remove怎么用?Java Bundle.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Bundle
的用法示例。
在下文中一共展示了Bundle.remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleActivityCreateBefore
import android.os.Bundle; //导入方法依赖的package包/类
/**
* @hide 内部方法,插件框架使用
* 插件的Activity的onCreate调用前调用此方法
* @param activity
* @param savedInstanceState
*/
public void handleActivityCreateBefore(Activity activity, Bundle savedInstanceState) {
if (LOG) {
LogDebug.d(PLUGIN_TAG, "activity create before: " + activity.getClass().getName() + " this=" + activity.hashCode() + " taskid=" + activity.getTaskId());
}
// 对FragmentActivity做特殊处理
if (savedInstanceState != null) {
//
savedInstanceState.setClassLoader(activity.getClassLoader());
//
try {
savedInstanceState.remove("android:support:fragments");
} catch (Throwable e) {
if (LOGR) {
LogRelease.e(PLUGIN_TAG, "a.c.b1: " + e.getMessage(), e);
}
}
}
// 对FragmentActivity做特殊处理
Intent intent = activity.getIntent();
if (intent != null) {
intent.setExtrasClassLoader(activity.getClassLoader());
activity.setTheme(getThemeId(activity, intent));
}
}
示例2: onQueryComplete
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onQueryComplete(int token, Uri uri, Bundle extras, boolean trigger, Uri createUri) {
assignContactUri(uri);
if (trigger && uri != null) {
// Found contact, so trigger QuickContact
ContactsContract.QuickContact.showQuickContact(getContext(),
ContactBadge.this, uri, ContactsContract.QuickContact.MODE_LARGE, mExcludeMimes);
} else if (createUri != null) {
// Prompt user to add this person to contacts
final Intent intent = new Intent(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT, createUri);
if (extras != null) {
extras.remove(Constants.EXTRA_URI_CONTENT);
intent.putExtras(extras);
}
getContext().startActivity(intent);
}
}
示例3: onCreate
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
setEnableCardToast(true);
super.onCreate(savedInstanceState);
enableCheckOnlineOnResumed(true);
if ( !getThread(savedInstanceState) )
return;
chatSDKChatHelper = new ChatSDKChatHelper(this, thread, chatSDKUiHelper);
chatSDKChatHelper.restoreSavedInstance(savedInstanceState);
if (savedInstanceState != null)
{
listPos = savedInstanceState.getInt(LIST_POS, -1);
savedInstanceState.remove(LIST_POS);
}
initActionBar();
}
示例4: 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;
}
示例5: handleImagesOnAction
import android.os.Bundle; //导入方法依赖的package包/类
private static void handleImagesOnAction(Bundle parameters) {
// In general, graph objects are passed by reference (ID/URL). But if this is an OG Action,
// we need to pass the entire values of the contents of the 'image' property, as they
// contain important metadata beyond just a URL.
String imageStr = parameters.getString("image");
if (imageStr != null) {
try {
// Check to see if this is an json array. Will throw if not
JSONArray images = new JSONArray(imageStr);
for (int i = 0; i < images.length(); ++i) {
JSONObject jsonImage = images.optJSONObject(i);
if(jsonImage != null) {
putImageInBundleWithArrayFormat(parameters, i, jsonImage);
} else {
// If we don't have jsonImage we probably just have a url
String url = images.getString(i);
parameters.putString(String.format(Locale.ROOT, "image[%d][url]", i), url);
}
}
parameters.remove("image");
return;
} catch (JSONException ex) {
// We couldn't parse the string as an array
}
// If the image is not in an array it might just be an single photo
try {
JSONObject image = new JSONObject(imageStr);
putImageInBundleWithArrayFormat(parameters, 0, image);
parameters.remove("image");
} catch (JSONException exception) {
// The image was not in array format or a json object and can be safely passed
// without modification
}
}
}
示例6: putJSONValueInBundle
import android.os.Bundle; //导入方法依赖的package包/类
public static boolean putJSONValueInBundle(Bundle bundle, String key, Object value) {
if (value == null) {
bundle.remove(key);
} else if (value instanceof Boolean) {
bundle.putBoolean(key, (boolean) value);
} else if (value instanceof boolean[]) {
bundle.putBooleanArray(key, (boolean[]) value);
} else if (value instanceof Double) {
bundle.putDouble(key, (double) value);
} else if (value instanceof double[]) {
bundle.putDoubleArray(key, (double[]) value);
} else if (value instanceof Integer) {
bundle.putInt(key, (int) value);
} else if (value instanceof int[]) {
bundle.putIntArray(key, (int[]) value);
} else if (value instanceof Long) {
bundle.putLong(key, (long) value);
} else if (value instanceof long[]) {
bundle.putLongArray(key, (long[]) value);
} else if (value instanceof String) {
bundle.putString(key, (String) value);
} else if (value instanceof JSONArray) {
bundle.putString(key, ((JSONArray) value).toString());
} else if (value instanceof JSONObject) {
bundle.putString(key, ((JSONObject) value).toString());
} else {
return false;
}
return true;
}
示例7: restoreState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void restoreState(Bundle savedState) {
if (savedState.containsKey(POSITION_PARCELABLE_KEY)) {
mPositionSavedState = savedState.getParcelable(POSITION_PARCELABLE_KEY);
changeGrid((Grid) savedState.getParcelable(CURRENT_GRID));
restorePosition();
savedState.remove(POSITION_PARCELABLE_KEY);
}
}
示例8: onExampleCallback
import android.os.Bundle; //导入方法依赖的package包/类
/**
* This example method is exposed to simulate a callback from your Intent Service, once a keyphrase
* has been detected.
*
* @param bundle containing associated keyphrase extras
*/
public void onExampleCallback(final Bundle bundle) {
if (getActivity() != null && tvResults != null && bundle != null && !bundle.isEmpty()) {
appendText(null);
final ArrayList<String> voiceData = bundle.getStringArrayList(Request.RESULTS_RECOGNITION);
final float[] confidenceScore = bundle.getFloatArray(Request.CONFIDENCE_SCORES);
if (confidenceScore != null && voiceData != null && confidenceScore.length == voiceData.size()) {
for (int i = 0; i < voiceData.size(); i++) {
Log.i(CLS_NAME, "onSpeechResults: " + voiceData.get(i) + " ~ " + confidenceScore[i]);
appendText(voiceData.get(i) + " ~ " + confidenceScore[i]);
}
} else if (voiceData != null) {
for (int i = 0; i < voiceData.size(); i++) {
Log.i(CLS_NAME, "onSpeechResults: " + voiceData.get(i));
appendText(voiceData.get(i));
}
} else {
Log.w(CLS_NAME, "onSpeechResults: values error");
appendText("onSpeechResults: values error");
}
appendText("\n");
bundle.remove(Request.RESULTS_RECOGNITION);
bundle.remove(Request.CONFIDENCE_SCORES);
final Set<String> keys = bundle.keySet();
for (final String key : keys) {
appendText(key + ": " + bundle.get(key));
}
if (voiceData != null && !voiceData.isEmpty()) {
switch (bundle.getInt(SaiyKeyphrase.SAIY_ACTION, 0)) {
case DO_SOMETHING_1:
Log.i(CLS_NAME, "onHandleIntent: DO_SOMETHING_1");
appendText("Heard: " + SAUSAGES + "!");
break;
case DO_SOMETHING_2:
Log.i(CLS_NAME, "onHandleIntent: DO_SOMETHING_2");
appendText("\nStart the playlist: " + voiceData.get(0).toLowerCase(Locale.US)
.replaceFirst(SPOTIFY_PLAYLIST, "") + "!");
break;
case DO_SOMETHING_3:
Log.i(CLS_NAME, "onHandleIntent: DO_SOMETHING_3");
appendText("\nStart the album: " + voiceData.get(0).toLowerCase(Locale.US)
.replaceFirst(SPOTIFY_ALBUM, "") + "!");
break;
case DO_NOT_USE_ZERO:
Log.e(CLS_NAME, "onHandleIntent: DO_NOT_USE_ZERO");
break;
}
} else {
Log.e(CLS_NAME, "onHandleIntent: voice data empty - should not happen");
}
}
}
示例9: updateBundleFromNote
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Note -> Bundle
*/
private void updateBundleFromNote(Bundle outState) {
OrgHead head = mNote.getHead();
outState.putString(ARG_CURRENT_STATE, head.getState());
outState.putString(ARG_CURRENT_PRIORITY, head.getPriority());
outState.putString(ARG_CURRENT_TITLE, head.getTitle());
outState.putString(ARG_CURRENT_TAGS, TextUtils.join(" ", head.getTags()));
if (head.getScheduled() != null) {
outState.putString(ARG_CURRENT_SCHEDULED, head.getScheduled().toString());
}
if (head.getDeadline() != null) {
outState.putString(ARG_CURRENT_DEADLINE, head.getDeadline().toString());
}
if (head.getClosed() != null) {
outState.putString(ARG_CURRENT_CLOSED, head.getClosed().toString());
}
/* Store properties as an array of strings: name1 value1 name2 value2 ... */
if (head.hasProperties()) {
ArrayList<String> array = new ArrayList<>();
for (OrgProperty property: head.getProperties()) {
array.add(property.getName());
array.add(property.getValue());
}
outState.putStringArrayList(ARG_CURRENT_PROPERTIES, array);
} else {
outState.remove(ARG_CURRENT_PROPERTIES);
}
outState.putString(ARG_CURRENT_CONTENT, head.getContent());
}
示例10: saveIds
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Save selected items.
* Restored with {@link Selection#restoreIds(android.os.Bundle)}.
*/
public void saveIds(Bundle bundle) {
if (getCount() > 0) {
long[] idsArray = new long[mSelectedIds.size()];
int i = 0;
for (long id: mSelectedIds) {
idsArray[i++] = id;
}
bundle.putLongArray(SAVED_BUNDLE_KEY, idsArray);
} else {
bundle.remove(SAVED_BUNDLE_KEY);
}
}
示例11: handleNewBundle
import android.os.Bundle; //导入方法依赖的package包/类
private void handleNewBundle(ISupportFragment toFragment, ISupportFragment stackToFragment) {
Bundle argsNewBundle = toFragment.getSupportDelegate().mNewBundle;
Bundle args = getArguments((Fragment) toFragment);
if (args.containsKey(FRAGMENTATION_ARG_CONTAINER)) {
args.remove(FRAGMENTATION_ARG_CONTAINER);
}
if (argsNewBundle != null) {
args.putAll(argsNewBundle);
}
stackToFragment.onNewBundle(args);
}
示例12: restoreSavedInstance
import android.os.Bundle; //导入方法依赖的package包/类
public void restoreSavedInstance(Bundle savedInstanceState){
if (savedInstanceState == null)
return;
selectedFilePath = savedInstanceState.getString(SELECTED_FILE_PATH);
savedInstanceState.remove(SELECTED_FILE_PATH);
}
示例13: restoreState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void restoreState(Bundle savedState) {
if (savedState.containsKey(POSITION_PARCELABLE_KEY)) {
mPositionSavedState = savedState.getParcelable(POSITION_PARCELABLE_KEY);
mYear = savedState.getInt(CURRENT_YEAR);
mMonth = savedState.getInt(CURRENT_MONTH);
savedState.remove(POSITION_PARCELABLE_KEY);
}
}
示例14: upload
import android.os.Bundle; //导入方法依赖的package包/类
public static Statistic upload(Context context, String str, Bundle bundle) throws MalformedURLException, IOException, NetworkUnavailableException, HttpStatusException {
int size;
int i;
byte[] byteArray;
if (context != null) {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
if (connectivityManager != null) {
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetworkInfo == null || !activeNetworkInfo.isAvailable()) {
throw new NetworkUnavailableException(NetworkUnavailableException.ERROR_INFO);
}
}
}
Bundle bundle2 = new Bundle(bundle);
String str2 = "";
str2 = bundle2.getString("appid_for_getting_config");
bundle2.remove("appid_for_getting_config");
HttpClient httpClient = HttpUtils.getHttpClient(context, str2, str);
HttpUriRequest httpPost = new HttpPost(str);
Bundle bundle3 = new Bundle();
for (String str22 : bundle2.keySet()) {
Object obj = bundle2.get(str22);
if (obj instanceof byte[]) {
bundle3.putByteArray(str22, (byte[]) obj);
}
}
httpPost.setHeader(HttpRequest.HEADER_CONTENT_TYPE, "multipart/form-data; boundary=3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f");
httpPost.setHeader("Connection", "Keep-Alive");
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byteArrayOutputStream.write(getBytesUTF8("--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f\r\n"));
byteArrayOutputStream.write(getBytesUTF8(encodePostBody(bundle2, "3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f")));
if (!bundle3.isEmpty()) {
size = bundle3.size();
byteArrayOutputStream.write(getBytesUTF8("\r\n--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f\r\n"));
i = -1;
for (String str222 : bundle3.keySet()) {
i++;
byteArrayOutputStream.write(getBytesUTF8("Content-Disposition: form-data; name=\"" + str222 + "\"; filename=\"" + "value.file" + "\"" + "\r\n"));
byteArrayOutputStream.write(getBytesUTF8("Content-Type: application/octet-stream\r\n\r\n"));
byteArray = bundle3.getByteArray(str222);
if (byteArray != null) {
byteArrayOutputStream.write(byteArray);
}
if (i < size - 1) {
byteArrayOutputStream.write(getBytesUTF8("\r\n--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f\r\n"));
}
}
}
byteArrayOutputStream.write(getBytesUTF8("\r\n--3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f--\r\n"));
byteArray = byteArrayOutputStream.toByteArray();
i = byteArray.length + 0;
byteArrayOutputStream.close();
httpPost.setEntity(new ByteArrayEntity(byteArray));
HttpResponse execute = httpClient.execute(httpPost);
size = execute.getStatusLine().getStatusCode();
if (size == 200) {
return new Statistic(a(execute), i);
}
throw new HttpStatusException(HttpStatusException.ERROR_INFO + size);
}
示例15: handleNewBundle
import android.os.Bundle; //导入方法依赖的package包/类
private void handleNewBundle(SupportFragment toFragment, Fragment stackToFragment) {
Bundle argsNewBundle = toFragment.getNewBundle();
Bundle args = toFragment.getArguments();
if (args.containsKey(FRAGMENTATION_ARG_CONTAINER)) {
args.remove(FRAGMENTATION_ARG_CONTAINER);
}
if (argsNewBundle != null) {
args.putAll(argsNewBundle);
}
((SupportFragment) stackToFragment).onNewBundle(args);
}