Java Code Examples for android.content.Intent.getDoubleArrayExtra()

The following are Jave code examples for showing how to use getDoubleArrayExtra() of the android.content.Intent 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: cordova-plugin-navigation   File: NavigationActivity.java   View Source Code Vote up 6 votes
private void initPoint() {
    Intent intent = getIntent();
    double[] start = intent.getDoubleArrayExtra("start");
    double[] end = intent.getDoubleArrayExtra("end");
    sList.add(new NaviLatLng(start[0], start[1]));
    eList.add(new NaviLatLng(end[0], end[1]));
    this.isEmulator = intent.getIntExtra("type", 1) == 0;
    if (this.isEmulator) {
        navigation.setEmulatorNaviSpeed(75);
    }
}
 
Example 2
Project: smartkey   File: IntentValueGetter.java   View Source Code Vote up 6 votes
/**
 * Get a value from an intent by a giving class and key.
 * @param intent
 *  the source intent
 * @param key
 *  the key of the value
 * @param clz
 *  the class of the value
 * @return
 *  the value from the source intent
 */
public static Object getValue(Intent intent, String key, Class<?> clz) {
    Object value = null;
    // Cause it is not an easy job to handle inheritance in apt, it is a lot easier to put the code in the Android environment.
    if(Bundle.class.isAssignableFrom(clz)) {
        // bundle implements parcelable, so it should place before parcelable.
        value = intent.getBundleExtra(key);
    } else if(Parcelable.class.isAssignableFrom(clz)) {
        value = intent.getParcelableExtra(key);
    } else if(Parcelable[].class.isAssignableFrom(clz)) {
        value = intent.getParcelableArrayExtra(key);
    } else if(boolean[].class.isAssignableFrom(clz)) {
        value = intent.getBooleanArrayExtra(key);
    } else if(byte[].class.isAssignableFrom(clz)) {
        value = intent.getByteArrayExtra(key);
    } else if(short[].class.isAssignableFrom(clz)) {
        value = intent.getShortArrayExtra(key);
    } else if(char[].class.isAssignableFrom(clz)) {
        value = intent.getCharArrayExtra(key);
    } else if(int[].class.isAssignableFrom(clz)) {
        value = intent.getIntArrayExtra(key);
    } else if(long[].class.isAssignableFrom(clz)) {
        value = intent.getLongArrayExtra(key);
    } else if(float[].class.isAssignableFrom(clz)) {
        value = intent.getFloatArrayExtra(key);
    } else if(double[].class.isAssignableFrom(clz)) {
        value = intent.getDoubleArrayExtra(key);
    } else if(String[].class.isAssignableFrom(clz)) {
        value = intent.getStringArrayExtra(key);
    } else if(CharSequence[].class.isAssignableFrom(clz)) {
        value = intent.getCharSequenceArrayExtra(key);
    } else if(Serializable.class.isAssignableFrom(clz)) {
        // some of the above are assignable for serializable, so serializable should be in the last place.
        value = intent.getSerializableExtra(key);
    } else {
        throw new RuntimeException(clz + " is not compatible with intent (key=" + key + ")");
    }

    return value;
}
 
Example 3
Project: NISTGammaSearch   File: CalcAttenuationActivity.java   View Source Code Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_calc_attenuation);
    Intent intent = getIntent();
    fEnergyList = intent.getDoubleArrayExtra(DisplayMaterialActivity.ATTEN_ENERGY);
    fCoeffList = intent.getDoubleArrayExtra(DisplayMaterialActivity.ATTEN_COEFF);
    fDensity = intent.getDoubleExtra(SearchOptionSelect.SEARCH_OBJECT_DENSITY, 0.0);
    EditText editTextDensity = (EditText) findViewById(R.id.editTextDensity);
    editTextDensity.setText(Double.toString(fDensity));
}
 
Example 4
Project: Android_OpenGL_Demo   File: GLReferenceActivity.java   View Source Code Vote up 6 votes
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == GAME_ACTIVITY_CODE) {
        if (resultCode == RESULT_OK) {
            // Benchmark passed
            mSetUpTimes = data.getDoubleArrayExtra(GLGameActivity.SET_UP_TIME);
            mUpdateTimes = data.getDoubleArrayExtra(GLGameActivity.UPDATE_TIMES);
            mRenderTimes = data.getDoubleArrayExtra(GLGameActivity.RENDER_TIMES);
        } else {
            setException(new Exception("Benchmark failed to run"));
        }
        // Release semiphore.
        mSemaphore.release();
        finish();
    }
}