下面列出了android.os.Bundle#putString ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString("mYms", mYms);
outState.putBoolean("isRetry", isRetry);
if (mScrollView != null) {
outState.putInt("mPos", mScrollView.getVerticalScrollbarPosition());
}
if (mList != null) {
outState.putString("mList", new Gson().toJson(mList));
}
if (mSelectedModel != null) {
outState.putString("mSelectedModel", new Gson().toJson(mSelectedModel));
}
if (mSemesterList != null) {
outState.putString("mSemesterList", new Gson().toJson(mSemesterList));
}
if (mScoreDetailModel != null) {
outState.putString("mScoreDetailModel", new Gson().toJson(mScoreDetailModel));
}
}
/**
* Send timing information.
*
* @param category The event category.
* @param variable The variable.
* @param label The label.
* @param duration The duration.
*/
public static void sendTiming(final Category category, final String variable, final String label, final long duration) {
getDefaultFirebaseAnalytics();
Bundle params = new Bundle();
params.putString("category", category.toString());
params.putString("variable", variable);
if (label == null) {
params.putString("label", variable);
}
else {
params.putString("label", variable + " - " + label);
}
params.putLong("value", duration);
mFirebaseAnalytics.logEvent("Timing", params);
}
public AmenitySetupDialog create() {
AmenitySetupDialog dialogFragment = new AmenitySetupDialog();
Bundle args = new Bundle();
if (mTitle != null)
args.putString("title", mTitle);
dialogFragment.setCallback(mCallback);
dialogFragment.setArguments(args);
return dialogFragment;
}
public Bundle getReadableReservedRegion()
{
Bundle bundle = new Bundle();
bundle.putString("bytesPerSector", String.valueOf(bytesPerSector));
bundle.putString("sectorsPerCluster", String.valueOf(sectorsPerCluster));
bundle.putString("numberReservedSectors", String.valueOf(numberReservedSectors));
bundle.putString("fatCopies", String.valueOf(fatCopies));
bundle.putString("numberSectorsPerFat", String.valueOf(numberSectorsPerFat));
bundle.putString("rootFirstCluster", String.valueOf(rootFirstCluster));
return bundle;
}
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putParcelable(STATE_USER, user);
if (firstPageShotLikes.size() > 0) {
outState.putParcelableArrayList(STATE_FIRST_PAGE_DATA, (ArrayList<? extends Parcelable>) firstPageShotLikes);
}
outState.putString(STATE_NEXT_PAGE_URL, getNextPageUrl());
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(MEDIA_TYPE, mediaType);
outState.putParcelable(SORT_METHOD, sortMethod);
try {
outState.putParcelableArrayList(PATH_CONTENTS, (ArrayList<LocalFileLocation>) ((MediaPictureListAdapter) getAdapter()).getFileItemList());
} catch (NullPointerException npe) {
// adapter is null probably nothing was save in bundle because the directory is empty
// ignore this so that the empty message would display later on
}
outState.putParcelableArrayList(ROOT_PATH_CONTENTS, rootFileLocation);
outState.putBoolean(ROOT_VISITED, browseRootAlready);
}
/**
* Create an instance of InstallerXDialogFragment with given apk source uri and UriHostFactory class.
* If {@code apkSourceUri} is null, dialog will let user pick apk source file.
* If {@code uriHostFactoryClass} is null, {@link com.aefyr.sai.installerx.resolver.urimess.impl.AndroidUriHost} will be used.
*
* @param apkSourceUri
* @param uriHostFactoryClass
* @return
*/
public static InstallerXDialogFragment newInstance(@Nullable Uri apkSourceUri, @Nullable Class<? extends UriHostFactory> uriHostFactoryClass) {
Bundle args = new Bundle();
if (apkSourceUri != null)
args.putParcelable(ARG_APK_SOURCE_URI, apkSourceUri);
if (uriHostFactoryClass != null)
args.putString(ARG_URI_HOST_FACTORY, uriHostFactoryClass.getCanonicalName());
InstallerXDialogFragment fragment = new InstallerXDialogFragment();
fragment.setArguments(args);
return fragment;
}
public static NewsFragment newInstance(String title) {
NewsFragment newsFragment = new NewsFragment();
Bundle bundle = new Bundle();
bundle.putString("title", title);
newsFragment.setArguments(bundle);
return newsFragment;
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString("body", mBodyEditText.getText().toString());
outState.putString("title", mTitleEditText.getText().toString());
outState.putBoolean("anoay", mAnonyCheckBox.isChecked());
}
public void show(String tag) {
Bundle args = new Bundle();
args.putString(KEY_TITLE, mTitle);
args.putInt(KEY_MIN_VAL, mMin);
args.putInt(KEY_MAX_VAL, mMax);
args.putString(KEY_DISABLE_BUTTON, mDisableButton);
args.putInt(KEY_DEFAULT_VAL, mDefault);
DurationPickerDialogFragment dialogFragment = new DurationPickerDialogFragment();
dialogFragment.setArguments(args);
dialogFragment.setTargetFragment(mTargetFragment, 0);
dialogFragment.show(mFragmentManager, tag);
}
@Override
public void onEditReq(String def, @RouteParamItem.Type int type) {
Bundle bundle = new Bundle();
bundle.putString(PARAM1, def);
if (type == RouteParamItem.Type.BOOLEAN) {
bundle.putStringArray(PARAM3, Utils.newArray("true", "false"));
bundle.putBoolean(PARAM4, true);
} else {
bundle.putBoolean(PARAM2, type != RouteParamItem.Type.STRING);
}
launch(EditFragment.class, bundle, CODE1);
}
public static ShaderListPreferenceDialogFragment newInstance(
String key) {
Bundle bundle = new Bundle();
bundle.putString(ARG_KEY, key);
ShaderListPreferenceDialogFragment fragment =
new ShaderListPreferenceDialogFragment();
fragment.setArguments(bundle);
return fragment;
}
public void deleteRecord(String s, IUiListener iuilistener)
{
Bundle bundle = composeCGIParams();
com.tencent.connect.common.BaseApi.TempRequestListener temprequestlistener = new com.tencent.connect.common.BaseApi.TempRequestListener(this, new k(this, iuilistener));
bundle.putString("key", Util.toHexString(s));
HttpUtils.requestAsync(mToken, mContext, "https://graph.qq.com/weiyun/delete_record", bundle, "GET", temprequestlistener);
}
@NonNull
public static DataListPreferenceDialogFragmentCompat newInstance(@NonNull Preference preference) {
DataListPreferenceDialogFragmentCompat fragment = new DataListPreferenceDialogFragmentCompat();
Bundle bundle = new Bundle(1);
bundle.putString("key", preference.getKey());
fragment.setArguments(bundle);
return fragment;
}
@NonNull
public static DoorsNLocksAccessListFragment newInstance(AccessSummary subsystem) {
DoorsNLocksAccessListFragment fragment = new DoorsNLocksAccessListFragment();
Bundle bundle = new Bundle();
bundle.putString(ACCESS_NAME_KEY,subsystem.getName());
bundle.putString(ACCESS_DEVICE_ID_KEY, subsystem.getDeviceId());
fragment.setArguments(bundle);
return fragment;
}
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putBoolean(BUNDLE_IS_IN_EDIT_MODE, isInEditMode);
outState.putBoolean(BUNDLE_IS_CHOOSE_PHOTO_LAYOUT_SHOWN, isChoosePhotoLayoutShown);
outState.putString(weMessage.BUNDLE_CONVERSATION_CHAT, chatUuid);
outState.putString(BUNDLE_EDITED_NAME, editedName);
outState.putString(BUNDLE_EDITED_PICTURE, editedChatPicture);
super.onSaveInstanceState(outState);
}
@Override
public void onStop() {
if (DEBUG) {
Log.d(TAG, "onStop()");
}
if (mCurrentResponse != null) {
setResult(mCurrentResponse, DConnectMessage.RESULT_OK);
sendResponse(mCurrentResponse);
mCurrentResponse = null;
}
for(Event event : EventManager.INSTANCE.getEventList(getService().getId(), PROFILE_NAME, null, AT_ON_STATUS_CHANGE)) {
Bundle root = new Bundle();
Bundle streaming = new Bundle();
streaming.putString(PARAM_KEY_URI, mHostDeviceLiveStreamRecorder.getBroadcastURI());
streaming.putString(PARAM_KEY_STATUS, "stop");
Bundle video = new Bundle();
video.putString(PARAM_KEY_URI, mVideoURI);
video.putInt(PARAM_KEY_WIDTH, mHostDeviceLiveStreamRecorder.getVideoWidth());
video.putInt(PARAM_KEY_HEIGHT, mHostDeviceLiveStreamRecorder.getVideoHeight());
video.putInt(PARAM_KEY_BITRATE, mHostDeviceLiveStreamRecorder.getBitrate());
video.putInt(PARAM_KEY_FRAME_RATE, mHostDeviceLiveStreamRecorder.getFrameRate());
video.putString(PARAM_KEY_MIME_TYPE, mHostDeviceLiveStreamRecorder.getLiveStreamingMimeType());
streaming.putParcelable(PARAM_KEY_VIDEO, video);
root.putParcelable(PARAM_KEY_STREAMING, streaming);
sendEvent(event, root);
}
}
public static ChatMessagesFragment newStatusInstance(ServerConnectionInfo server) {
ChatMessagesFragment fragment = new ChatMessagesFragment();
Bundle args = new Bundle();
args.putString(ARG_SERVER_UUID, server.getUUID().toString());
args.putBoolean(ARG_DISPLAY_STATUS, true);
fragment.setArguments(args);
return fragment;
}
@Override
public Bundle getParams()
{
Bundle bundle = new Bundle();
bundle.putString("unread", "0");
return bundle;
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(SUBREDDIT_NAME_STATE, subredditName);
outState.putBoolean(SUBREDDIT_IS_USER_STATE, subredditIsUser);
}