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


Java Bundle.putDoubleArray方法代码示例

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


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

示例1: testBundleConstructor

import android.os.Bundle; //导入方法依赖的package包/类
@Test
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void testBundleConstructor() {
    Bundle platformBundle = new Bundle();
    platformBundle.putString("string", "string");
    platformBundle.putInt("int", 0);
    platformBundle.putLong("long", 0);
    platformBundle.putDouble("double", 0);
    platformBundle.putStringArray("string_array", new String[]{"one", "two", "three"});
    platformBundle.putIntArray("int_array", new int[]{1, 2, 3});
    platformBundle.putLongArray("long_array", new long[]{1, 2, 3});
    platformBundle.putDoubleArray("double_array", new double[]{1, 2, 3});

    PersistableBundle bundle = new PersistableBundle(platformBundle);
    assertEquals(platformBundle.getString("string"), bundle.getString("string"));
    assertEquals(platformBundle.getInt("int"), bundle.getInt("int"));
    assertEquals(platformBundle.getLong("long"), bundle.getLong("long"));
    assertEquals(platformBundle.getDouble("double"), bundle.getDouble("double"), 0.01);
    assertArrayEquals(platformBundle.getStringArray("string_array"), bundle.getStringArray("string_array"));
    assertArrayEquals(platformBundle.getIntArray("int_array"), bundle.getIntArray("int_array"));
    assertArrayEquals(platformBundle.getLongArray("long_array"), bundle.getLongArray("long_array"));
    assertArrayEquals(platformBundle.getDoubleArray("double_array"), bundle.getDoubleArray("double_array"), 0.01);
}
 
开发者ID:Doist,项目名称:JobSchedulerCompat,代码行数:24,代码来源:PersistableBundleTest.java

示例2: moveTo

import android.os.Bundle; //导入方法依赖的package包/类
/**
 * Creates a bundle with the data for the move command
 * @param x coordinates on the x axis
 * @param y coordinates on the y axis
 * @param z coordinates on the z axis
 * @param phi roll attitude angle
 * @param theta pitch attitude angle
 * @param gamma yaw attitude angle
 * @return bundle of move command data
 */
public Bundle moveTo(double x, double y, double z, double phi, double theta, double gamma){
    //For now only passing the xyz position. Keeping tolerances and quaternions unchanged.
    Bundle bundle = new Bundle();
    String cmd = CMD_NAME_SIMPLE_MOVE6DOF;
    int numArgs = 6;
    double [] pos = new double[3];
    double [] att = new double[3];
    pos[0] = x;
    pos[1] = y;
    pos[2] = z;
    att[0] = phi;
    att[1] = theta;
    att[2] = gamma;
    bundle.putString("cmd", cmd);
    bundle.putInt("numArgs", numArgs);
    bundle.putDoubleArray("pos", pos);
    bundle.putDoubleArray("att", att);

    return bundle;
}
 
开发者ID:nasa,项目名称:astrobee_android,代码行数:31,代码来源:RobotCommands.java

示例3: toBundle

import android.os.Bundle; //导入方法依赖的package包/类
@NonNull
public Bundle toBundle() {
    Bundle bundle = new Bundle(map.size());
    for (Map.Entry<String, Object> entry : map.entrySet()) {
        String key = entry.getKey();
        Object value = entry.getValue();
        if (value == null) {
            bundle.putString(key, null);
        } else if (value instanceof String) {
            bundle.putString(key, (String) value);
        } else if (value instanceof Integer) {
            bundle.putInt(key, (Integer) value);
        } else if (value instanceof Long) {
            bundle.putLong(key, (Long) value);
        } else if (value instanceof Double) {
            bundle.putDouble(key, (Double) value);
        } else if (value instanceof Boolean) {
            bundle.putBoolean(key, (Boolean) value);
        } else if (value instanceof String[]) {
            bundle.putStringArray(key, (String[]) value);
        } else if (value instanceof int[]) {
            bundle.putIntArray(key, (int[]) value);
        } else if (value instanceof long[]) {
            bundle.putLongArray(key, (long[]) 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 PersistableBundle) {
            bundle.putBundle(key, ((PersistableBundle) value).toBundle());
        }
    }
    return bundle;
}
 
开发者ID:Doist,项目名称:JobSchedulerCompat,代码行数:35,代码来源:PersistableBundle.java

示例4: putJSONValueInBundle

import android.os.Bundle; //导入方法依赖的package包/类
public static boolean putJSONValueInBundle(Bundle bundle, String key, Object value) {
    if (value == null) {
        bundle.remove(key);
    } else if (value instanceof Boolean) {
        bundle.putBoolean(key, (boolean) value);
    } else if (value instanceof boolean[]) {
        bundle.putBooleanArray(key, (boolean[]) value);
    } else if (value instanceof Double) {
        bundle.putDouble(key, (double) value);
    } else if (value instanceof double[]) {
        bundle.putDoubleArray(key, (double[]) value);
    } else if (value instanceof Integer) {
        bundle.putInt(key, (int) value);
    } else if (value instanceof int[]) {
        bundle.putIntArray(key, (int[]) value);
    } else if (value instanceof Long) {
        bundle.putLong(key, (long) value);
    } else if (value instanceof long[]) {
        bundle.putLongArray(key, (long[]) value);
    } else if (value instanceof String) {
        bundle.putString(key, (String) value);
    } else if (value instanceof JSONArray) {
        bundle.putString(key, ((JSONArray) value).toString());
    } else if (value instanceof JSONObject) {
        bundle.putString(key, ((JSONObject) value).toString());
    } else {
        return false;
    }
    return true;
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:31,代码来源:Utility.java

示例5: 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);
        }

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

示例6: putDoubleArray

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

示例7: putDoubleArray

import android.os.Bundle; //导入方法依赖的package包/类
public void putDoubleArray(Bundle state, String key, double[] x) {
    state.putDoubleArray(key + mBaseKey, x);
}
 
开发者ID:evernote,项目名称:android-state,代码行数:4,代码来源:InjectionHelper.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.putDoubleArray(field.getBundleKey(), (double[]) propertyField.get(to));
}
 
开发者ID:leobert-lan,项目名称:MagicBox,代码行数:7,代码来源:DoubleArrayWriter.java

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

示例10: onSaveInstanceState

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putDoubleArray(SaveLoad.SaveKey, SaveLoad.get().serialize(this.game));
}
 
开发者ID:subchannel13,项目名称:EnchantedFortress,代码行数:6,代码来源:GameFragment.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: onCharacteristicChanged

import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
    super.onCharacteristicChanged(gatt, characteristic);
    Log.d("BLUETOOTH", "onCharacteristicChanged");

    if(characteristic.getUuid().equals(UUID_MOVEMENT_DATA)){
        byte[] valores = characteristic.getValue();

        double acc_x = (valores[7] << 8) +  valores[6];
        double acc_y = (valores[9] << 8) +  valores[8];
        double acc_z = (valores[11] << 8) +  valores[10];


        double acc_scaledX = (sensorMpu9250AccConvert(acc_x) * GRAVITIY) * (-1);
        double acc_scaledY =  sensorMpu9250AccConvert(acc_y) * GRAVITIY;
        double acc_scaledZ = (sensorMpu9250AccConvert(acc_z) * GRAVITIY) * (-1);

        Log.d("ACELEROMETRO", "Value: " + acc_scaledX + " : " + acc_scaledY + " : " + acc_scaledZ);

        double gyro_x = (valores[1] << 8) +  valores[0];
        double gyro_y = (valores[3] << 8) +  valores[2];
        double gyro_z = (valores[5] << 8) +  valores[4];


        double gyro_scaledX = (sensorMpu9250GyroConvert(gyro_x)) * (Math.PI/180) * (-1);
        double gyro_scaledY = (sensorMpu9250GyroConvert(gyro_y)) * (Math.PI/180);
        double gyro_scaledZ = (sensorMpu9250GyroConvert(gyro_z)) * (Math.PI/180) * (-1);

        Log.d("GIROSCOPIO  ", "Value: " + gyro_scaledX + " : " + gyro_scaledY + " : " + gyro_scaledZ);

        double[] datosAcelGyro = {acc_scaledX, acc_scaledY, acc_scaledZ, gyro_scaledX, gyro_scaledY, gyro_scaledZ};

        Bundle bundle = new Bundle();
        bundle.putDoubleArray("datos", datosAcelGyro);

        //TODO crear constantes para los codigos de envio
        resultReceiverEnvioDatos.send(100, bundle);



    }
}
 
开发者ID:TfgReconocimientoPulseras,项目名称:TrainAppTFG,代码行数:43,代码来源:BluetoothLeService.java

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


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