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


Java Bundle.putShort方法代码示例

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


在下文中一共展示了Bundle.putShort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onConfigDone

import android.os.Bundle; //导入方法依赖的package包/类
public void onConfigDone(short addr, boolean success, byte confOp) {
    Message msg = new Message();
    Bundle bundle = new Bundle();
    bundle.putByte(MESH_EVT_MSG_PAR_KEY_EVENT, MESH_EVENT_ON_CONFIG_DONE);
    bundle.putShort(MESH_EVT_MSG_PAR_KEY_DEVADDR, addr);
    Byte succ;
    if (success) {
        succ = 1;
    } else {
        succ = 0;
    }
    bundle.putByte(MESH_EVT_MSG_PAR_KEY_SUCCESS, succ);
    bundle.putByte(MESH_EVT_MSG_PAR_KEY_CONFOP, confOp);
    msg.setData(bundle);
    mEvtHdl.sendMessage(msg);
}
 
开发者ID:blxble,项目名称:mesh-core-on-android,代码行数:17,代码来源:MeshService.java

示例3: onAccessMessageIndication

import android.os.Bundle; //导入方法依赖的package包/类
public void onAccessMessageIndication(byte eltIdx, MeshModelMessageOpcode msgOp, byte[] msgParam,
                                      short srcAddr, int appkeyIdx, byte rssi) {
    ElementCallbackInfo eltCbkInfo;
    Message msg = new Message();
    Bundle bundle = new Bundle();

    bundle.putParcelable(MESH_ACC_MSG_PAR_KEY_OPCODE, msgOp);
    bundle.putByteArray(MESH_ACC_MSG_PAR_KEY_PARAM, msgParam);
    bundle.putShort(MESH_ACC_MSG_PAR_KEY_SRCADDR, srcAddr);
    bundle.putInt(MESH_ACC_MSG_PAR_KEY_APPKEYIDX, appkeyIdx);
    bundle.putByte(MESH_ACC_MSG_PAR_KEY_RSSI, rssi);

    msg.setData(bundle);

    for (int i = 0; i < mEltCbkInfoList.size(); i++) {
        eltCbkInfo = mEltCbkInfoList.get(i);
        if (eltCbkInfo.eltIdx == eltIdx) {
            eltCbkInfo.eltHdl.sendMessage(msg);
            break;
        }
    }
}
 
开发者ID:blxble,项目名称:mesh-core-on-android,代码行数:23,代码来源:MeshService.java

示例4: setBundleValue

import android.os.Bundle; //导入方法依赖的package包/类
/**
 * @param typeDef type
 * @param key     key
 * @param value   value
 */
public static void setBundleValue(Bundle bundle, Integer typeDef, String key, String value) {
    if (TextUtils.isEmpty(key) || TextUtils.isEmpty(value)) {
        return;
    }

    try {
        if (null != typeDef) {
            if (typeDef == Type.BOOLEAN.ordinal()) {
                bundle.putBoolean(key, Boolean.parseBoolean(value));
            } else if (typeDef == Type.BYTE.ordinal()) {
                bundle.putByte(key, Byte.valueOf(value));
            } else if (typeDef == Type.SHORT.ordinal()) {
                bundle.putShort(key, Short.valueOf(value));
            } else if (typeDef == Type.INT.ordinal()) {
                bundle.putInt(key, Integer.valueOf(value));
            } else if (typeDef == Type.LONG.ordinal()) {
                bundle.putLong(key, Long.valueOf(value));
            } else if (typeDef == Type.FLOAT.ordinal()) {
                bundle.putFloat(key, Float.valueOf(value));
            } else if (typeDef == Type.DOUBLE.ordinal()) {
                bundle.putDouble(key, Double.valueOf(value));
            } else if (typeDef == Type.STRING.ordinal()) {
                bundle.putString(key, value);
            } else if (typeDef == Type.PARCELABLE.ordinal()) {
            } else if (typeDef == Type.OBJECT.ordinal()) {
                bundle.putString(key, value);
            } else {
                bundle.putString(key, value);
            }
        } else {
            bundle.putString(key, value);
        }
    } catch (Throwable ex) {
    }
}
 
开发者ID:luojilab,项目名称:DDComponentForAndroid,代码行数:41,代码来源:UriUtils.java

示例5: notifyDeviceNode

import android.os.Bundle; //导入方法依赖的package包/类
private void notifyDeviceNode(byte notify_event, byte notify_state, short notify_addr){
    Message msg = new Message();
    Bundle bundle = new Bundle();
    bundle.putByte("Event", notify_event);
    bundle.putByte("State", notify_state);
    bundle.putShort("Addr", notify_addr);
    msg.setData(bundle);
    mNotifyHandle.sendMessage(msg);
}
 
开发者ID:blxble,项目名称:mesh-core-on-android,代码行数:10,代码来源:ActiveDevice.java

示例6: onNewDevice

import android.os.Bundle; //导入方法依赖的package包/类
public void onNewDevice(short devAddr, byte[] uuid) {
    Message msg = new Message();
    Bundle bundle = new Bundle();
    bundle.putByte(MESH_EVT_MSG_PAR_KEY_EVENT, MESH_EVENT_ON_NEW_DEVICE);
    bundle.putShort(MESH_EVT_MSG_PAR_KEY_DEVADDR, devAddr);
    bundle.putByteArray(MESH_EVT_MSG_PAR_KEY_UUID, uuid);
    msg.setData(bundle);
    mEvtHdl.sendMessage(msg);
}
 
开发者ID:blxble,项目名称:mesh-core-on-android,代码行数:10,代码来源:MeshService.java

示例7: onNetkeyUpdated

import android.os.Bundle; //导入方法依赖的package包/类
public void onNetkeyUpdated(short netkeyIdx) {
    Message msg = new Message();
    Bundle bundle = new Bundle();
    bundle.putByte(MESH_EVT_MSG_PAR_KEY_EVENT, MESH_EVENT_ON_NETKEY_UPDATED);
    bundle.putShort(MESH_EVT_MSG_PAR_KEY_NETKEYIDX, netkeyIdx);
    msg.setData(bundle);
    mEvtHdl.sendMessage(msg);
}
 
开发者ID:blxble,项目名称:mesh-core-on-android,代码行数:9,代码来源:MeshService.java

示例8: onAppkeyUpdated

import android.os.Bundle; //导入方法依赖的package包/类
public void onAppkeyUpdated(short appkeyIdx) {
    Message msg = new Message();
    Bundle bundle = new Bundle();
    bundle.putByte(MESH_EVT_MSG_PAR_KEY_EVENT, MESH_EVENT_ON_APPKEY_UPDATED);
    bundle.putShort(MESH_EVT_MSG_PAR_KEY_APPKEYIDX, appkeyIdx);
    msg.setData(bundle);
    mEvtHdl.sendMessage(msg);
}
 
开发者ID:blxble,项目名称:mesh-core-on-android,代码行数:9,代码来源:MeshService.java

示例9: putShort

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

示例10: putBoxedShort

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

示例11: putShort

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

示例12: putBoxedShort

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

示例13: 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

示例14: 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

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


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