Java Code Examples for android.content.Intent#getFloatArrayExtra()

The following examples show how to use android.content.Intent#getFloatArrayExtra() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {

    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK) switch (requestCode) {
        case CODE_FOR_CROP: {
            float[] points = data.getFloatArrayExtra(Constant.CLIP_POINTS);
            String name = data.getStringExtra(Constant.PROFILE_NAME);
            insertDataToDB(new ProfileEntity(1, name, points[0], points[1], points[2], points[3]));
            new SweetAlertDialog(ProfileActivity.this, SweetAlertDialog.SUCCESS_TYPE).setTitleText("Image Cropped").setConfirmText("Ok").show();
            profiles.add(new Profile(name, points[0], points[1], points[2], points[3]));
            mProfileAdapter.notifyDataSetChanged();
            break;
        }
        case Constant.CODE_FOR_SCREEN_CAPTURE: {
            MediaProjectionHelper.setMediaProjectionManager(mMediaProjectionManager);
            MediaProjectionHelper.setScreenshotPermission(data);
            startService(mScreenshotIntent);
            finish();
            break;
        }
    }
}
 
Example 2
Source Project: SEAL-Demo   File: RunActivity.java    License: MIT License 5 votes vote down vote up
/**
 * updates sensors data
 * @param intent the update intent from Service
 */
private void updateSensorsData(Intent intent){
    float accelerometerMatrix[] = intent.getFloatArrayExtra(ACCELEROMETER_KEY);
    Log.d(TAG,"Accelerometer x = "+accelerometerMatrix[0]+" y = "+accelerometerMatrix[1]+" z = "+accelerometerMatrix[2]);
    accelerometerValues.add(accelerometerMatrix);
    float gyroscopeMatrix[] = intent.getFloatArrayExtra(GYROSCOPE_KEY);
    Log.d(TAG,"Gyroscope x = "+gyroscopeMatrix[0]+" y = "+gyroscopeMatrix[1]+" z = "+gyroscopeMatrix[2]);
    gyroscopeValues.add(gyroscopeMatrix);
}
 
Example 3
protected void onActivityResult(int requestCode,
                                int resultCode, Intent data) {
  if (requestCode == TTS_DATA_CHECK) {
    if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
      tts = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
        public void onInit(int status) {
          if (status == TextToSpeech.SUCCESS) {
            ttsIsInit = true;
            if (tts.isLanguageAvailable(Locale.UK) >= 0)
              tts.setLanguage(Locale.UK);
            tts.setPitch(0.8f);
            tts.setSpeechRate(1.1f);
            speak();
          }
        }
      });
    } else {
      Intent installVoice = new Intent(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
      startActivity(installVoice);
    }
  }

  // Listing 14-3: Finding the results of a speech recognition request
  if (requestCode == VOICE_RECOGNITION && resultCode == RESULT_OK) {
    ArrayList<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
    float[] confidence = data.getFloatArrayExtra(RecognizerIntent.EXTRA_CONFIDENCE_SCORES);
    // TODO Do something with the recognized voice strings
  }
}
 
Example 4
/**
 * Utility to get the position extras from an intent.
 *
 * @param intent the intent.
 * @return the position as accuracy, speed, bearing.
 */
public static float[] getPositionExtras(Intent intent) {
    if (intent == null) {
        return null;
    }
    float[] positionExtras = intent.getFloatArrayExtra(GPS_SERVICE_POSITION_EXTRAS);
    return positionExtras;
}
 
Example 5
Source Project: Ticket-Analysis   File: IntentUtil.java    License: MIT License 4 votes vote down vote up
public static float[] getFloatArrayExtra(Intent intent, String name) {
    if (!hasIntent(intent) || !hasExtra(intent, name)) return null;
    return intent.getFloatArrayExtra(name);
}