本文整理了Java中android.os.Bundle.getCharArray()
方法的一些代码示例,展示了Bundle.getCharArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bundle.getCharArray()
方法的具体详情如下:
包路径:android.os.Bundle
类名称:Bundle
方法名:getCharArray
暂无
代码示例来源:origin: robolectric/robolectric
@Test
public void charArray() {
char [] arr = new char[] { 'c', 'j' };
bundle.putCharArray("foo", arr);
assertThat(bundle.getCharArray("foo")).isEqualTo(arr);
assertThat(bundle.getCharArray("bar")).isNull();
}
代码示例来源:origin: konmik/nucleus
when(bundle.getCharArray(anyString())).thenAnswer(get);
代码示例来源: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: facebook/facebook-android-sdk
assertArrayEquals(originalBundle.getDoubleArray(DOUBLE_ARRAY_KEY), cachedBundle.getDoubleArray(DOUBLE_ARRAY_KEY));
assertEquals(originalBundle.getChar(CHAR_KEY), cachedBundle.getChar(CHAR_KEY));
assertArrayEquals(originalBundle.getCharArray(CHAR_ARRAY_KEY), cachedBundle.getCharArray(CHAR_ARRAY_KEY));
assertEquals(originalBundle.getString(STRING_KEY), cachedBundle.getString(STRING_KEY));
assertListEquals(originalBundle.getStringArrayList(STRING_LIST_KEY), cachedBundle.getStringArrayList(
代码示例来源:origin: fengdai/FragmentMaster
/**
* Retrieve extended data from the request.
*
* @param name The name of the desired item.
* @return the value of an item that previously added with putExtra() or
* null if no char array value was found.
* @see #putExtra(String, char[])
*/
public char[] getCharArrayExtra(String name) {
return mExtras == null ? null : mExtras.getCharArray(name);
}
代码示例来源:origin: kayoSun/Tack
public char[] getChars(String key){
if (mBundle != null) {
return mBundle.getCharArray(key);
}
return null;
}
代码示例来源:origin: evernote/android-state
public char[] getCharArray(Bundle state, String key) {
return state.getCharArray(key + mBaseKey);
}
代码示例来源:origin: hansenji/pocketknife
@Override
public String get(Bundle bundle, String data, String keyPrefix) {
char[] inArray = bundle.getCharArray(keyPrefix);
char[] outArray = new char[inArray.length - keyPrefix.length()];
System.arraycopy(inArray, keyPrefix.length(), outArray, 0, outArray.length);
return new String(outArray);
}
内容来源于网络,如有侵权,请联系作者删除!