本文整理了Java中android.os.Bundle.getString()
方法的一些代码示例,展示了Bundle.getString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bundle.getString()
方法的具体详情如下:
包路径:android.os.Bundle
类名称:Bundle
方法名:getString
暂无
代码示例来源:origin: stackoverflow.com
Bundle bundle = getIntent().getExtras();
int value = bundle.getInt("some_key");
String value2 = bundle.getString("some_other_key");
代码示例来源:origin: googlesamples/easypermissions
RationaleDialogConfig(Bundle bundle) {
positiveButton = bundle.getString(KEY_POSITIVE_BUTTON);
negativeButton = bundle.getString(KEY_NEGATIVE_BUTTON);
rationaleMsg = bundle.getString(KEY_RATIONALE_MESSAGE);
theme = bundle.getInt(KEY_THEME);
requestCode = bundle.getInt(KEY_REQUEST_CODE);
permissions = bundle.getStringArray(KEY_PERMISSIONS);
}
代码示例来源:origin: stackoverflow.com
Intent intent = getIntent();
Bundle extras = intent.getExtras();
String username_string = extras.getString("EXTRA_USERNAME");
String password_string = extras.getString("EXTRA_PASSWORD");
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onRestoreInstanceState(Bundle state) {
format.setText(state.getString("format"));
contents.setText(state.getString("contents"));
}
}
代码示例来源:origin: stephentuso/welcome-android
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Bundle args = getArguments();
if (args == null)
return;
drawableId = args.getInt(ARG_DRAWABLE_ID);
title = args.getString(ARG_TITLE);
imageView.setImageResource(drawableId);
titleView.setText(title);
int titleColor = args.getInt(ARG_TITLE_COLOR, WelcomeUtils.NO_COLOR_SET);
if (titleColor != WelcomeUtils.NO_COLOR_SET)
titleView.setTextColor(titleColor);
showParallaxAnim = args.getBoolean(ARG_SHOW_ANIM, showParallaxAnim);
WelcomeUtils.setTypeface(titleView, args.getString(ARG_TYPEFACE_PATH), getActivity());
}
代码示例来源:origin: naman14/Timber
private void setAlbumart() {
playlistname.setText(getIntent().getExtras().getString(Constants.PLAYLIST_NAME));
foreground.setBackgroundColor(getIntent().getExtras().getInt(Constants.PLAYLIST_FOREGROUND_COLOR));
loadBitmap(TimberUtils.getAlbumArtUri(getIntent().getExtras().getLong(Constants.ALBUM_ID)).toString());
}
代码示例来源:origin: stackoverflow.com
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putString("message", "This is my message to be reloaded");
super.onSaveInstanceState(outState);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
String message = savedInstanceState.getString("message");
Toast.makeText(this, message, Toast.LENGTH_LONG).show();
}
}
代码示例来源:origin: bluelinelabs/Conductor
@Override
protected void onViewBound(@NonNull View view) {
super.onViewBound(view);
tvTitle.setText(getArgs().getString(KEY_TITLE));
int bgColor = getArgs().getInt(KEY_BG_COLOR);
if (getArgs().getBoolean(KEY_COLOR_IS_RES)) {
bgColor = ContextCompat.getColor(getActivity(), bgColor);
}
view.setBackgroundColor(bgColor);
}
}
代码示例来源:origin: stackoverflow.com
mTime = savedInstanceState.getString("time_key");
} else {
mTime = "" + Calendar.getInstance().getTimeInMillis();
title.setText(mTime);
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString("time_key", mTime);
代码示例来源:origin: tyzlmjj/PagerBottomTabStrip
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
String content = getArguments().getString(ARG_C);
TextView textView = new TextView(getContext());
textView.setTextSize(30);
textView.setGravity(Gravity.CENTER);
textView.setText(String.format("Test\n\n%s", content));
textView.setBackgroundColor(0xFFececec);
return textView;
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView row=
(TextView)super.getView(position, convertView, parent);
String key=getItem(position);
if (RestrictionEntriesReceiver.RESTRICTION_BOOLEAN.equals(key)) {
int icon=
restrictions.getBoolean(key) ? R.drawable.ic_true
: R.drawable.ic_false;
row.setCompoundDrawablesWithIntrinsicBounds(0, 0, icon, 0);
}
else if (RestrictionEntriesReceiver.RESTRICTION_CHOICE.equals(key)) {
row.setText(String.format("%s (%s)", key,
restrictions.getString(key)));
}
else {
String value=
TextUtils.join(" | ", restrictions.getStringArray(key));
row.setText(String.format("%s (%s)", key, value));
}
return(row);
}
}
代码示例来源:origin: ankidroid/Anki-Android
@Override
public Message getDialogHandlerMessage() {
Message msg = Message.obtain();
msg.what = DialogHandler.MSG_SHOW_SYNC_ERROR_DIALOG;
Bundle b = new Bundle();
b.putInt("dialogType", getArguments().getInt("dialogType"));
b.putString("dialogMessage", getArguments().getString("dialogMessage"));
msg.setData(b);
return msg;
}
代码示例来源:origin: konmik/nucleus
when(bundle.getDouble(anyString(), anyDouble())).thenAnswer(getOrDefault);
doAnswer(put).when(bundle).putString(anyString(), anyString());
when(bundle.getString(anyString())).thenAnswer(get);
when(bundle.getString(anyString(), anyString())).thenAnswer(getOrDefault);
when(bundle.getInt(anyString())).thenAnswer(get);
when(bundle.getInt(anyString(), anyInt())).thenAnswer(getOrDefault);
代码示例来源:origin: stackoverflow.com
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case DATEPICKER_FRAGMENT:
if (resultCode == Activity.RESULT_OK) {
Bundle bundle = data.getExtras();
String mMonth = bundle.getString("month", Month);
int mYear = bundle.getInt("year");
Log.i("PICKER", "Got year=" + year + " and month=" + month + ", yay!");
} else if (resultCode == Activity.RESULT_CANCELED) {
...
}
break;
}
}
代码示例来源:origin: facebook/facebook-android-sdk
innerBundle2.putString("inner", "2");
innerBundle2.putStringArray("deep list", new String[] {"7", "8"});
b.putLong("longValue", 5000000000l);
b.putDouble("doubleValue", 3.14);
b.putString("stringValue", "hello world");
b.putStringArray("stringArrayValue", new String[] {"first", "second"});
b.putStringArrayList("stringArrayListValue", arrayList);
assertEquals(7, finalBundle.getInt("intValue"));
assertEquals(5000000000l, finalBundle.getLong("longValue"));
assertEquals(3.14, finalBundle.getDouble("doubleValue"), TestUtils.DOUBLE_EQUALS_DELTA);
assertEquals("hello world", finalBundle.getString("stringValue"));
assertEquals(1, finalInnerBundle.getInt("inner"));
finalBundle = finalInnerBundle.getBundle("nested bundle");
assertEquals("2", finalBundle.getString("inner"));
代码示例来源:origin: stackoverflow.com
/* Start Activity */
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClassName("com.thinoo.ActivityTest", "com.thinoo.ActivityTest.NewActivity");
startActivityForResult(intent,90);
}
/* Called when the second activity's finished */
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch(requestCode) {
case 90:
if (resultCode == RESULT_OK) {
Bundle res = data.getExtras();
String result = res.getString("param_result");
Log.d("FIRST", "result:"+result);
}
break;
}
}
private void finishWithResult()
{
Bundle conData = new Bundle();
conData.putString("param_result", "Thanks Thanks");
Intent intent = new Intent();
intent.putExtras(conData);
setResult(RESULT_OK, intent);
finish();
}
代码示例来源:origin: mikepenz/MaterialDrawer
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
// don't look at this layout it's just a listView to show how to handle the keyboard
View view = inflater.inflate(R.layout.fragment_sample, container, false);
TextView textView = (TextView) view.findViewById(R.id.title);
textView.setText(getArguments().getString(KEY_TITLE));
return view;
}
}
代码示例来源:origin: stephentuso/welcome-android
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.wel_fragment_basic, container, false);
Bundle args = getArguments();
imageView = (ImageView) view.findViewById(R.id.wel_image);
titleView = (TextView) view.findViewById(R.id.wel_title);
descriptionView = (TextView) view.findViewById(R.id.wel_description);
if (args == null)
return view;
showParallaxAnim = args.getBoolean(KEY_SHOW_ANIM, showParallaxAnim);
imageView.setImageResource(args.getInt(KEY_DRAWABLE_ID));
if (args.getString(KEY_TITLE) != null)
titleView.setText(args.getString(KEY_TITLE));
if (args.getString(KEY_DESCRIPTION) != null)
descriptionView.setText(args.getString(KEY_DESCRIPTION));
int headerColor = args.getInt(KEY_HEADER_COLOR, WelcomeUtils.NO_COLOR_SET);
if (headerColor != WelcomeUtils.NO_COLOR_SET)
titleView.setTextColor(headerColor);
int descriptionColor = args.getInt(KEY_DESCRIPTION_COLOR, WelcomeUtils.NO_COLOR_SET);
if (descriptionColor != WelcomeUtils.NO_COLOR_SET)
descriptionView.setTextColor(descriptionColor);
WelcomeUtils.setTypeface(titleView, args.getString(KEY_HEADER_TYPEFACE_PATH), getActivity());
WelcomeUtils.setTypeface(descriptionView, args.getString(KEY_DESCRIPTION_TYPEFACE_PATH), getActivity());
return view;
}
代码示例来源:origin: stackoverflow.com
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
// Restore UI state from the savedInstanceState.
// This bundle has also been passed to onCreate.
boolean myBoolean = savedInstanceState.getBoolean("MyBoolean");
double myDouble = savedInstanceState.getDouble("myDouble");
int myInt = savedInstanceState.getInt("MyInt");
String myString = savedInstanceState.getString("MyString");
}
代码示例来源:origin: stackoverflow.com
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (mImageUri != null) {
outState.putString("cameraImageUri", mImageUri.toString());
}
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
if (savedInstanceState.containsKey("cameraImageUri")) {
mImageUri = Uri.parse(savedInstanceState.getString("cameraImageUri"));
}
}
内容来源于网络,如有侵权,请联系作者删除!