Java Code Examples for android.os.Bundle.putByte()
The following are Jave code examples for showing how to use
putByte() of the
android.os.Bundle
class.
You can vote up the examples you like. Your votes will be used in our system to get
more good examples.
+ Save this method
Example 1
Project: letv File: KVUtils.java View Source Code | 7 votes |
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; }
Example 2
Project: mesh-core-on-android File: MeshService.java View Source Code | 6 votes |
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; } } }
Example 3
Project: letv File: KVUtils.java View Source Code | 6 votes |
public static Bundle put(Bundle to, Bundle from, String key) { if (!(to == null || from == null || TextUtils.empty(key) || !from.containsKey(key))) { Object value = from.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; }
Example 4
Project: mesh-core-on-android File: MeshService.java View Source Code | 6 votes |
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); }
Example 5
Project: DDComponentForAndroid File: UriUtils.java View Source Code | 5 votes |
/** * @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) { } }
Example 6
Project: mesh-core-on-android File: ActiveDevice.java View Source Code | 5 votes |
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); }
Example 7
Project: mesh-core-on-android File: MeshService.java View Source Code | 5 votes |
public void onProxyStatusChanged(byte status) { Message msg = new Message(); Bundle bundle = new Bundle(); bundle.putByte(MESH_EVT_MSG_PAR_KEY_EVENT, MESH_EVENT_ON_PROXY_STATUS_CHANGED); bundle.putByte(MESH_EVT_MSG_PAR_KEY_PROXYSTATUS, status); msg.setData(bundle); mEvtHdl.sendMessage(msg); }
Example 8
Project: mesh-core-on-android File: MeshService.java View Source Code | 5 votes |
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); }
Example 9
Project: mesh-core-on-android File: MeshService.java View Source Code | 5 votes |
public void onNewProposer(byte[] uuid, byte[] bdAddr, byte[] extData, byte rssi) { Message msg = new Message(); Bundle bundle = new Bundle(); bundle.putByte(MESH_EVT_MSG_PAR_KEY_EVENT, MESH_EVENT_ON_NEW_PROPOSER); bundle.putByteArray(MESH_EVT_MSG_PAR_KEY_UUID, uuid); bundle.putByteArray(MESH_EVT_MSG_PAR_KEY_BDADDR, bdAddr); bundle.putByteArray(MESH_EVT_MSG_PAR_KEY_EXTDATA, extData); bundle.putByte(MESH_EVT_MSG_PAR_KEY_RSSI, rssi); msg.setData(bundle); mEvtHdl.sendMessage(msg); }
Example 10
Project: mesh-core-on-android File: MeshService.java View Source Code | 5 votes |
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); }
Example 11
Project: GitHub File: Injector.java View Source Code | 4 votes |
public void putByte(Bundle state, String key, byte x) { state.putByte(key + baseKey, x); }
Example 12
Project: GitHub File: Injector.java View Source Code | 4 votes |
public void putBoxedByte(Bundle state, String key, Byte x) { if (x != null) { state.putByte(key + baseKey, x); } }
Example 13
Project: android-state File: InjectionHelper.java View Source Code | 4 votes |
public void putByte(Bundle state, String key, byte x) { state.putByte(key + mBaseKey, x); }
Example 14
Project: android-state File: InjectionHelper.java View Source Code | 4 votes |
public void putBoxedByte(Bundle state, String key, Byte x) { if (x != null) { state.putByte(key + mBaseKey, x); } }
Example 15
Project: RxRemote File: RemoteEventController.java View Source Code | 4 votes |
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; } }
Example 16
Project: ucar-weex-core File: ArgumentsUtil.java View Source Code | 4 votes |
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; } }
Example 17
Project: MagicBox File: ByteWriter.java View Source Code | 4 votes |
@Override public void write(Bundle bundle, Object to, StateField field) throws IllegalAccessException { Field propertyField = field.getField(); propertyField.setAccessible(true); bundle.putByte(field.getBundleKey(), propertyField.getByte(to)); }
Example 18
Project: IPCInvoker File: ParameterHelper.java View Source Code | 4 votes |
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)); } }
Example 19
Project: Lunary-Ethereum-Wallet File: AddressDetailActivity.java View Source Code | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); address = getIntent().getStringExtra("ADDRESS"); type = getIntent().getByteExtra("TYPE", SCANNED_WALLET); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayShowTitleEnabled(false); getSupportActionBar().setDisplayHomeAsUpEnabled(true); title = (TextView) findViewById(R.id.toolbar_title); String walletname = AddressNameConverter.getInstance(this).get(address); title.setText(type == OWN_WALLET ? (walletname == null ? "Unnamed Wallet" : walletname) : "Address"); coord = (CoordinatorLayout) findViewById(R.id.main_content); appbar = (AppBarLayout) findViewById(R.id.appbar); fragments = new Fragment[3]; fragments[0] = new FragmentDetailShare(); fragments[1] = new FragmentDetailOverview(); fragments[2] = new FragmentTransactions(); Bundle bundle = new Bundle(); bundle.putString("ADDRESS", address); bundle.putDouble("BALANCE", getIntent().getDoubleExtra("BALANCE", 0)); bundle.putByte("TYPE", type); fragments[0].setArguments(bundle); fragments[1].setArguments(bundle); fragments[2].setArguments(bundle); mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.container); mViewPager.setAdapter(mSectionsPagerAdapter); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(mViewPager); tabLayout.setupWithViewPager(mViewPager); tabLayout.getTabAt(0).setIcon(R.drawable.ic_action_share); tabLayout.getTabAt(1).setIcon(R.drawable.ic_wallet); tabLayout.getTabAt(2).setIcon(R.drawable.ic_transactions); mViewPager.setCurrentItem(1); mViewPager.setOffscreenPageLimit(3); }
Example 20
Project: MRouter File: MainActivity.java View Source Code | 4 votes |
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; }