本文整理了Java中android.os.Bundle.getStringArray()
方法的一些代码示例,展示了Bundle.getStringArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bundle.getStringArray()
方法的具体详情如下:
包路径:android.os.Bundle
类名称:Bundle
方法名:getStringArray
暂无
代码示例来源:origin: stackoverflow.com
public class Frag2 extends Fragment {
public View onCreateView(LayoutInflater inflater,
ViewGroup containerObject,
Bundle savedInstanceState){
//here is your arguments
Bundle bundle=getArguments();
//here is your list array
String[] myStrings=bundle.getStringArray("elist");
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void getWrongType() {
bundle.putFloat("foo", 5f);
assertThat(bundle.getCharArray("foo")).isNull();
assertThat(bundle.getInt("foo")).isEqualTo(0);
assertThat(bundle.getIntArray("foo")).isNull();
assertThat(bundle.getIntegerArrayList("foo")).isNull();
assertThat(bundle.getShort("foo")).isEqualTo((short) 0);
assertThat(bundle.getShortArray("foo")).isNull();
assertThat(bundle.getBoolean("foo")).isFalse();
assertThat(bundle.getBooleanArray("foo")).isNull();
assertThat(bundle.getLong("foo")).isEqualTo(0);
assertThat(bundle.getLongArray("foo")).isNull();
assertThat(bundle.getFloatArray("foo")).isNull();
assertThat(bundle.getDouble("foo")).isEqualTo(0.0);
assertThat(bundle.getDoubleArray("foo")).isNull();
assertThat(bundle.getString("foo")).isNull();
assertThat(bundle.getStringArray("foo")).isNull();
assertThat(bundle.getStringArrayList("foo")).isNull();
assertThat(bundle.getBundle("foo")).isNull();
assertThat((Parcelable) bundle.getParcelable("foo")).isNull();
assertThat(bundle.getParcelableArray("foo")).isNull();
assertThat(bundle.getParcelableArrayList("foo")).isNull();
bundle.putInt("foo", 1);
assertThat(bundle.getFloat("foo")).isEqualTo(0.0f);
}
代码示例来源:origin: stackoverflow.com
Bundle b=this.getIntent().getExtras();
String[] array=b.getStringArray(key);
代码示例来源:origin: stackoverflow.com
Bundle b=this.getIntent().getExtras();
String[] array=b.getStringArray(key);
代码示例来源:origin: Naoki2015/CircleDemo
public String[] getThumbnail() {
return _Bundle.getStringArray(XTRA_THUMBNAIL);
}
代码示例来源:origin: facebook/facebook-android-sdk
@Nullable
/**
* Returns the value of a String[] argument associated with the passed in key. If the key does
* not exist, or if it points to an object that is not a String[], null will be returned.
*
* @param key Key for the value desired.
* @return The String[] associated with the passed in key, or null if the key does not exist or
* if the value is not a String[].
*/
public String[] getStringArray(final String key) {
return params.getStringArray(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
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
Uri baseUri = SmartCalProvider.CONTENT_URI;
makeProviderBundle(
new String[] { "_id, event_name, start_date, start_time, end_date, end_time, location" },
"date(?) >= start_date and date(?) <= end_date",
new String[]{ getChosenDate(), getChosenDate() },
null);
return new CursorLoader(
this,
baseUri,
args.getStringArray("projection"),
args.getString("selection"),
args.getStringArray("selectionArgs"),
args.getBoolean("sortOrder") ? args.getString("sortOrder") : null);
}
代码示例来源:origin: stackoverflow.com
public void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
String[] values = savedInstanceState.getStringArray("myKey");
if (values != null) {
mAdapter = new MyAdapter(values);
}
}
...
}
代码示例来源:origin: TangoAgency/material-intro-screen
public void initializeView() {
Bundle bundle = getArguments();
backgroundColor = bundle.getInt(BACKGROUND_COLOR);
buttonsColor = bundle.getInt(BUTTONS_COLOR);
image = bundle.getInt(IMAGE, 0);
title = bundle.getString(TITLE);
description = bundle.getString(DESCRIPTION);
neededPermissions = bundle.getStringArray(NEEDED_PERMISSIONS);
possiblePermissions = bundle.getStringArray(POSSIBLE_PERMISSIONS);
updateViewWithValues();
}
代码示例来源:origin: k9mail/k-9
@Override
public void onReceive(Context context, Intent intent) {
if (K9RemoteControl.K9_REQUEST_ACCOUNTS.equals(intent.getAction())) {
Bundle bundle = getResultExtras(false);
if (bundle == null) {
Timber.w("Response bundle is empty");
return;
}
receptor.accounts(bundle.getStringArray(K9RemoteControl.K9_ACCOUNT_UUIDS), bundle.getStringArray(K9RemoteControl.K9_ACCOUNT_DESCRIPTIONS));
}
}
代码示例来源:origin: donglua/PhotoPicker
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
paths = new ArrayList<>();
Bundle bundle = getArguments();
if (bundle != null) {
String[] pathArr = bundle.getStringArray(ARG_PATH);
paths.clear();
if (pathArr != null) {
paths = new ArrayList<>(Arrays.asList(pathArr));
}
currentItem = bundle.getInt(ARG_CURRENT_ITEM);
}
mPagerAdapter = new PhotoPagerAdapter(Glide.with(this), paths);
}
代码示例来源:origin: bluelinelabs/Conductor
@Override
public void restoreState(Parcelable state, ClassLoader loader) {
Bundle bundle = (Bundle)state;
if (state != null) {
savesState = bundle.getBoolean(KEY_SAVES_STATE, false);
savedPages = bundle.getSparseParcelableArray(KEY_SAVED_PAGES);
int[] visiblePageIdsKeys = bundle.getIntArray(KEY_VISIBLE_PAGE_IDS_KEYS);
String[] visiblePageIdsValues = bundle.getStringArray(KEY_VISIBLE_PAGE_IDS_VALUES);
visiblePageIds = new SparseArray<>(visiblePageIdsKeys.length);
for (int i = 0; i < visiblePageIdsKeys.length; i++) {
visiblePageIds.put(visiblePageIdsKeys[i], visiblePageIdsValues[i]);
}
}
}
代码示例来源: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: TeamNewPipe/NewPipe
public Deleter(Bundle b, View v, Context c, MissionAdapter a, DownloadManager d, MissionIterator i, Handler h) {
mView = v;
mContext = c;
mAdapter = a;
mDownloadManager = d;
mIterator = i;
mHandler = h;
// use variables to know the reference of the lambdas
rShow = this::show;
rNext = this::next;
rCommit = this::commit;
items = new ArrayList<>(2);
if (b != null) {
String[] names = b.getStringArray(BUNDLE_NAMES);
String[] locations = b.getStringArray(BUNDLE_LOCATIONS);
if (names == null || locations == null) return;
if (names.length < 1 || locations.length < 1) return;
if (names.length != locations.length) return;
items.ensureCapacity(names.length);
for (int j = 0; j < locations.length; j++) {
Mission mission = mDownloadManager.getAnyMission(locations[j], names[j]);
if (mission == null) continue;
items.add(mission);
mIterator.hide(mission);
}
if (items.size() > 0) resume();
}
}
代码示例来源:origin: aa112901/remusic
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// mPreferences = PreferencesUtility.getInstance(mContext);
if (getArguments() != null) {
page = getArguments().getInt("page_number");
title = getArguments().getStringArray("title");
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void stringArray() {
bundle.putStringArray("foo", new String[] { "a" });
assertThat(bundle.getStringArray("foo")).isEqualTo(new String[]{"a"});
assertThat(bundle.getStringArray("bar")).isNull();
}
代码示例来源:origin: commonsguy/cw-omnibus
private RestrictionEntry buildMultiSelectRestriction(Context ctxt,
Bundle current) {
RestrictionEntry entry=
new RestrictionEntry(RESTRICTION_MULTI,
current.getStringArray(RESTRICTION_MULTI));
entry.setTitle("A Multi-Select Restriction");
entry.setChoiceEntries(ctxt, R.array.display_values);
entry.setChoiceValues(ctxt, R.array.restriction_values);
return(entry);
}
}
代码示例来源:origin: LawnchairLauncher/Lawnchair
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
super.onReceiveResult(resultCode, resultData);
int[] grantResult = resultData.getIntArray("grantResult");
String[] permissions = resultData.getStringArray("permissions");
// Call the callback with the result
callback.onComplete(new PermissionResponse(permissions, grantResult, resultCode));
}
};
代码示例来源:origin: aa112901/remusic
ids = getArguments().getStringArray("ids");
names = getArguments().getStringArray("names");
内容来源于网络,如有侵权,请联系作者删除!