当前位置: 首页>>代码示例>>Java>>正文


Java Bundle.putChar方法代码示例

本文整理汇总了Java中android.os.Bundle.putChar方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.putChar方法的具体用法?Java Bundle.putChar怎么用?Java Bundle.putChar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.os.Bundle的用法示例。


在下文中一共展示了Bundle.putChar方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: put

import android.os.Bundle; //导入方法依赖的package包/类
public static Bundle put(Bundle to, Intent from, String key) {
    if (!(to == null || from == null || TextUtils.empty(key) || !from.hasExtra(key))) {
        Object value = from.getExtras().get(key);
        if (value instanceof Boolean) {
            to.putBoolean(key, ((Boolean) value).booleanValue());
        } else if (value instanceof Byte) {
            to.putByte(key, ((Byte) value).byteValue());
        } else if (value instanceof Character) {
            to.putChar(key, ((Character) value).charValue());
        } else if (value instanceof Short) {
            to.putShort(key, ((Short) value).shortValue());
        } else if (value instanceof Integer) {
            to.putInt(key, ((Integer) value).intValue());
        } else if (value instanceof Long) {
            to.putLong(key, ((Long) value).longValue());
        } else if (value instanceof Float) {
            to.putFloat(key, ((Float) value).floatValue());
        } else if (value instanceof Double) {
            to.putDouble(key, ((Double) value).doubleValue());
        } else if (value instanceof String) {
            to.putString(key, (String) value);
        }
    }
    return to;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:26,代码来源:KVUtils.java

示例2: putChar

import android.os.Bundle; //导入方法依赖的package包/类
public void putChar(Bundle state, String key, char x) {
    state.putChar(key + baseKey, x);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:Injector.java

示例3: putBoxedChar

import android.os.Bundle; //导入方法依赖的package包/类
public void putBoxedChar(Bundle state, String key, Character x) {
    if (x != null) {
        state.putChar(key + baseKey, x);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:Injector.java

示例4: putChar

import android.os.Bundle; //导入方法依赖的package包/类
public void putChar(Bundle state, String key, char x) {
    state.putChar(key + mBaseKey, x);
}
 
开发者ID:evernote,项目名称:android-state,代码行数:4,代码来源:InjectionHelper.java

示例5: putBoxedChar

import android.os.Bundle; //导入方法依赖的package包/类
public void putBoxedChar(Bundle state, String key, Character x) {
    if (x != null) {
        state.putChar(key + mBaseKey, x);
    }
}
 
开发者ID:evernote,项目名称:android-state,代码行数:6,代码来源:InjectionHelper.java

示例6: addDataToBundle

import android.os.Bundle; //导入方法依赖的package包/类
private void addDataToBundle(Bundle remoteData, Object data, RemoteDataType dataType, String keyPrefix) throws Exception {
    remoteData.putString(RemoteEventManager.REMOTE_DATA_TYPE + keyPrefix, dataType.name());
    switch (dataType) {
        case List:
            List listData = (List) data;
            int dataSize = listData != null ? listData.size() : 0;
            remoteData.putInt(RemoteEventManager.REMOTE_DATA_LIST_SIZE + keyPrefix, dataSize);
            RemoteDataType itemDataType = null;
            for (int i = 0; i < dataSize; i++) {
                Object item = listData.get(i);
                if (itemDataType == null) {
                    itemDataType = findDataType(item);
                }
                addDataToBundle(remoteData, item, itemDataType, keyPrefix + i);
            }
            break;

        case Parcelable:
            remoteData.putParcelable(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (Parcelable) data);
            break;
        case Parceler:
            writeParceler(data, remoteData, keyPrefix);
            break;
        case Remoter:
            writeRemoter(data, remoteData, keyPrefix);
            break;
        case Byte:
            remoteData.putByte(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (Byte) data);
            break;
        case Short:
            remoteData.putShort(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (Short) data);
            break;
        case Integer:
            remoteData.putInt(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (Integer) data);
            break;
        case Float:
            remoteData.putFloat(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (Float) data);
            break;
        case Double:
            remoteData.putDouble(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (Double) data);
            break;
        case String:
            remoteData.putString(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (String) data);
            break;
        case Char:
            remoteData.putChar(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (Character) data);
            break;
        case Long:
            remoteData.putLong(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, (Long) data);
            break;
        case Boolean:
            remoteData.putInt(RemoteEventManager.REMOTE_DATA_KEY + keyPrefix, ((Boolean) data).booleanValue() ? 1 : 0);
            break;
        case UnKnown:
            Log.w(TAG, "Ignoring unsupported type " + data);
            break;

    }
}
 
开发者ID:josesamuel,项目名称:RxRemote,代码行数:60,代码来源:RemoteEventController.java

示例7: fromJsonToBundle

import android.os.Bundle; //导入方法依赖的package包/类
public static Bundle fromJsonToBundle(JSONObject jsonObject) {
    Bundle budle = new Bundle();
    if (jsonObject == null) {
        return budle;
    } else {
        Iterator iterator = jsonObject.keySet().iterator();

        while (iterator.hasNext()) {
            String key = (String) iterator.next();
            Object value = jsonObject.get(key);
            if (value != null) {
                if (value instanceof String) {
                    budle.putString(key, (String) value);
                } else if (value instanceof Byte) {
                    budle.putByte(key, ((Byte) value).byteValue());
                } else if (value instanceof Short) {
                    budle.putShort(key, ((Short) value).shortValue());
                } else if (value instanceof Integer) {
                    budle.putInt(key, ((Integer) value).intValue());
                } else if (value instanceof Long) {
                    budle.putLong(key, ((Long) value).longValue());
                } else if (value instanceof Float) {
                    budle.putFloat(key, ((Float) value).floatValue());
                } else if (value instanceof Double) {
                    budle.putDouble(key, ((Double) value).doubleValue());
                } else if (value instanceof Boolean) {
                    budle.putBoolean(key, ((Boolean) value).booleanValue());
                } else if (value instanceof Character) {
                    budle.putChar(key, ((Character) value).charValue());
                } else if (value instanceof JSONObject) {
                    budle.putBundle(key, fromJsonToBundle((JSONObject) value));
                } else {
                    if (!value.getClass().isArray()) {
                        throw new IllegalArgumentException("Could not convert " + value.getClass());
                    }

                    fromArrayToBundle(budle, key, value);
                }
            }
        }

        return budle;
    }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:45,代码来源:ArgumentsUtil.java

示例8: 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.putChar(field.getBundleKey(), propertyField.getChar(to));
}
 
开发者ID:leobert-lan,项目名称:MagicBox,代码行数:7,代码来源:CharWriter.java

示例9: postRemote

import android.os.Bundle; //导入方法依赖的package包/类
public void postRemote(String remotePkg, char event) {
    Bundle bundle = new Bundle();
    bundle.putChar(ChidoriClient.CHIDORI_EVENT, event);
    send(remotePkg, bundle);
}
 
开发者ID:kymjs,项目名称:Chidori,代码行数:6,代码来源:EventBus.java

示例10: put

import android.os.Bundle; //导入方法依赖的package包/类
public static void put(Bundle bundle, String key, Object value) {
        if (value instanceof Integer) {
            bundle.putInt(key, (Integer) value);
        } else if (value instanceof Float) {
            bundle.putFloat(key, (Float) value);
        } else if (value instanceof Character) {
            bundle.putChar(key, (Character) value);
        } else if (value instanceof CharSequence) {
            bundle.putCharSequence(key, (CharSequence) value);
        } else if (value instanceof Long) {
            bundle.putLong(key, (Long) value);
        } else if (value instanceof Short) {
            bundle.putShort(key, (Short) value);
        } else if (value instanceof Byte) {
            bundle.putByte(key, (Byte) value);
        } else if (value instanceof Boolean) {
            bundle.putBoolean(key, (Boolean) value);
        } else if (value instanceof Double) {
            bundle.putDouble(key, (Double) value);
        } else if (value instanceof Parcelable) {
            bundle.putParcelable(key, (Parcelable) value);
        } else if (value instanceof Bundle) {
            bundle.putBundle(key, (Bundle) value);
        } else if (value instanceof int[]) {
            bundle.putIntArray(key, (int[]) value);
        } else if (value instanceof byte[]) {
            bundle.putByteArray(key, (byte[]) value);
        } else if (value instanceof float[]) {
            bundle.putFloatArray(key, (float[]) value);
        } else if (value instanceof double[]) {
            bundle.putDoubleArray(key, (double[]) value);
        } else if (value instanceof boolean[]) {
            bundle.putBooleanArray(key, (boolean[]) value);
        } else if (value instanceof long[]) {
            bundle.putLongArray(key, (long[]) value);
        } else if (value instanceof Parcelable[]) {
            bundle.putParcelableArray(key, (Parcelable[]) value);
        } else if (value instanceof short[]) {
            bundle.putShortArray(key, (short[]) value);
        } else if (value instanceof String[]) {
            bundle.putStringArray(key, (String[]) value);
        } else {
//            bundle.putString(key, String.valueOf(value));
        }
    }
 
开发者ID:AlbieLiang,项目名称:IPCInvoker,代码行数:46,代码来源:ParameterHelper.java

示例11: 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;
}
 
开发者ID:chiclaim,项目名称:MRouter,代码行数:74,代码来源:MainActivity.java

示例12: 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 Character fieldValue) {
    state.putChar(key, fieldValue);
}
 
开发者ID:Fondesa,项目名称:Lyra,代码行数:12,代码来源:CharCoder.java


注:本文中的android.os.Bundle.putChar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。