本文整理汇总了Java中android.os.Bundle.putCharArray方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.putCharArray方法的具体用法?Java Bundle.putCharArray怎么用?Java Bundle.putCharArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Bundle
的用法示例。
在下文中一共展示了Bundle.putCharArray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromArrayToBundle
import android.os.Bundle; //导入方法依赖的package包/类
public static void fromArrayToBundle(Bundle bundle, String key, Object array) {
if (bundle != null && !TextUtils.isEmpty(key) && array != null) {
if (array instanceof String[]) {
bundle.putStringArray(key, (String[]) ((String[]) array));
} else if (array instanceof byte[]) {
bundle.putByteArray(key, (byte[]) ((byte[]) array));
} else if (array instanceof short[]) {
bundle.putShortArray(key, (short[]) ((short[]) array));
} else if (array instanceof int[]) {
bundle.putIntArray(key, (int[]) ((int[]) array));
} else if (array instanceof long[]) {
bundle.putLongArray(key, (long[]) ((long[]) array));
} else if (array instanceof float[]) {
bundle.putFloatArray(key, (float[]) ((float[]) array));
} else if (array instanceof double[]) {
bundle.putDoubleArray(key, (double[]) ((double[]) array));
} else if (array instanceof boolean[]) {
bundle.putBooleanArray(key, (boolean[]) ((boolean[]) array));
} else if (array instanceof char[]) {
bundle.putCharArray(key, (char[]) ((char[]) array));
} else {
if (!(array instanceof JSONArray)) {
throw new IllegalArgumentException("Unknown array type " + array.getClass());
}
ArrayList arraylist = new ArrayList();
JSONArray jsonArray = (JSONArray) array;
Iterator it = jsonArray.iterator();
while (it.hasNext()) {
JSONObject object = (JSONObject) it.next();
arraylist.add(fromJsonToBundle(object));
}
bundle.putParcelableArrayList(key, arraylist);
}
}
}
示例2: putCharArray
import android.os.Bundle; //导入方法依赖的package包/类
public void putCharArray(Bundle state, String key, char[] x) {
state.putCharArray(key + baseKey, x);
}
示例3: putCharArray
import android.os.Bundle; //导入方法依赖的package包/类
public void putCharArray(Bundle state, String key, char[] x) {
state.putCharArray(key + mBaseKey, x);
}
示例4: write
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void write(Bundle bundle, Object to, StateField field) throws IllegalAccessException {
Field propertyField = field.getField();
propertyField.setAccessible(true);
bundle.putCharArray(field.getBundleKey(), (char[]) propertyField.get(to));
}
示例5: assembleBundle
import android.os.Bundle; //导入方法依赖的package包/类
public Bundle assembleBundle() {
User user = new User();
user.setAge(90);
user.setGender(1);
user.setName("kitty");
Address address = new Address();
address.setCity("HangZhou");
address.setProvince("ZheJiang");
Bundle extras = new Bundle();
extras.putString("extra", "from extras");
ArrayList<String> stringList = new ArrayList<>();
stringList.add("Java");
stringList.add("C#");
stringList.add("Kotlin");
ArrayList<String> stringArrayList = new ArrayList<>();
stringArrayList.add("American");
stringArrayList.add("China");
stringArrayList.add("England");
ArrayList<Integer> intArrayList = new ArrayList<>();
intArrayList.add(100);
intArrayList.add(101);
intArrayList.add(102);
ArrayList<Integer> intList = new ArrayList<>();
intList.add(10011);
intList.add(10111);
intList.add(10211);
ArrayList<Address> addressList = new ArrayList<>();
addressList.add(new Address("JiangXi", "ShangRao", null));
addressList.add(new Address("ZheJiang", "NingBo", null));
Address[] addressArray = new Address[]{
new Address("Beijing", "Beijing", null),
new Address("Shanghai", "Shanghai", null),
new Address("Guangzhou", "Guangzhou", null)
};
Bundle bundle = new Bundle();
bundle.putSerializable("user", user);
bundle.putParcelable("address", address);
bundle.putParcelableArrayList("addressList", addressList);
bundle.putParcelableArray("addressArray", addressArray);
bundle.putString("param", "chiclaim");
bundle.putStringArray("stringArray", new String[]{"a", "b", "c"});
bundle.putStringArrayList("stringArrayList", stringList);
bundle.putStringArrayList("stringList", stringArrayList);
bundle.putByte("byte", (byte) 2);
bundle.putByteArray("byteArray", new byte[]{1, 2, 3, 4, 5});
bundle.putInt("age", 33);
bundle.putIntArray("intArray", new int[]{10, 11, 12, 13});
bundle.putIntegerArrayList("intList", intList);
bundle.putIntegerArrayList("intArrayList", intArrayList);
bundle.putChar("chara", 'c');
bundle.putCharArray("charArray", "chiclaim".toCharArray());
bundle.putShort("short", (short) 1000000);
bundle.putShortArray("shortArray", new short[]{(short) 10.9, (short) 11.9});
bundle.putDouble("double", 1200000);
bundle.putDoubleArray("doubleArray", new double[]{1232, 9999, 8789, 3.1415926});
bundle.putLong("long", 999999999);
bundle.putLongArray("longArray", new long[]{1000, 2000, 3000});
bundle.putFloat("float", 333);
bundle.putFloatArray("floatArray", new float[]{12.9f, 234.9f});
bundle.putBoolean("boolean", true);
bundle.putBooleanArray("booleanArray", new boolean[]{true, false, true});
return bundle;
}
示例6: serialize
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Write a field's value into the saved state {@link Bundle}.
*
* @param state {@link Bundle} used to save the state
* @param key key retrieved from {@code fieldDeclaringClass#fieldName}
* @param fieldValue value of field
*/
@Override
public void serialize(@NonNull Bundle state, @NonNull String key, @NonNull char[] fieldValue) {
state.putCharArray(key, fieldValue);
}