List of usage examples for android.content Intent getDoubleExtra
public double getDoubleExtra(String name, double defaultValue)
From source file:com.droid080419.droid080419.elevenfifty_nine.EditTaskActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == AltAddTaskActivity.ADD_TASK_REQUEST && resultCode == RESULT_OK) { if (data != null && data.hasExtra("LATITUDE") && data.hasExtra("LONGITUDE")) { coords = new LatLng(data.getDoubleExtra("LATITUDE", MapsActivity.UPD.latitude), data.getDoubleExtra("LONGITUDE", MapsActivity.UPD.longitude)); Log.d("MAPS", "EXTRas"); }/*from ww w .j av a 2 s.c om*/ } super.onActivityResult(requestCode, resultCode, data); }
From source file:com.fenlisproject.elf.core.framework.ElfBinder.java
public static void bindIntentExtra(Object receiver) { Field[] fields = receiver.getClass().getDeclaredFields(); for (Field field : fields) { field.setAccessible(true);//www .j a v a 2 s. c o m IntentExtra intentExtra = field.getAnnotation(IntentExtra.class); if (intentExtra != null) { try { Intent intent = null; if (receiver instanceof Activity) { intent = ((Activity) receiver).getIntent(); } else if (receiver instanceof Fragment) { intent = ((Fragment) receiver).getActivity().getIntent(); } if (intent != null) { Class<?> type = field.getType(); if (type == Boolean.class || type == boolean.class) { field.set(receiver, intent.getBooleanExtra(intentExtra.value(), false)); } else if (type == Byte.class || type == byte.class) { field.set(receiver, intent.getByteExtra(intentExtra.value(), (byte) 0)); } else if (type == Character.class || type == char.class) { field.set(receiver, intent.getCharExtra(intentExtra.value(), '\u0000')); } else if (type == Double.class || type == double.class) { field.set(receiver, intent.getDoubleExtra(intentExtra.value(), 0.0d)); } else if (type == Float.class || type == float.class) { field.set(receiver, intent.getFloatExtra(intentExtra.value(), 0.0f)); } else if (type == Integer.class || type == int.class) { field.set(receiver, intent.getIntExtra(intentExtra.value(), 0)); } else if (type == Long.class || type == long.class) { field.set(receiver, intent.getLongExtra(intentExtra.value(), 0L)); } else if (type == Short.class || type == short.class) { field.set(receiver, intent.getShortExtra(intentExtra.value(), (short) 0)); } else if (type == String.class) { field.set(receiver, intent.getStringExtra(intentExtra.value())); } else if (type == Boolean[].class || type == boolean[].class) { field.set(receiver, intent.getBooleanArrayExtra(intentExtra.value())); } else if (type == Byte[].class || type == byte[].class) { field.set(receiver, intent.getByteArrayExtra(intentExtra.value())); } else if (type == Character[].class || type == char[].class) { field.set(receiver, intent.getCharArrayExtra(intentExtra.value())); } else if (type == Double[].class || type == double[].class) { field.set(receiver, intent.getDoubleArrayExtra(intentExtra.value())); } else if (type == Float[].class || type == float[].class) { field.set(receiver, intent.getFloatArrayExtra(intentExtra.value())); } else if (type == Integer[].class || type == int[].class) { field.set(receiver, intent.getIntArrayExtra(intentExtra.value())); } else if (type == Long[].class || type == long[].class) { field.set(receiver, intent.getLongArrayExtra(intentExtra.value())); } else if (type == Short[].class || type == short[].class) { field.set(receiver, intent.getShortArrayExtra(intentExtra.value())); } else if (type == String[].class) { field.set(receiver, intent.getStringArrayExtra(intentExtra.value())); } else if (Serializable.class.isAssignableFrom(type)) { field.set(receiver, intent.getSerializableExtra(intentExtra.value())); } else if (type == Bundle.class) { field.set(receiver, intent.getBundleExtra(intentExtra.value())); } } } catch (IllegalAccessException e) { e.printStackTrace(); } } } }
From source file:org.onebusaway.android.report.ui.InfrastructureIssueActivity.java
/** * Returns an intent that will start the MapActivity with a particular stop * focused with the center of the map at a particular point. * * @param context The context of the activity. * @param intent The Intent containing focusId, lat, lon of the map *//*from w w w.j a v a 2 s . co m*/ public static Intent makeIntent(Context context, Intent intent) { Intent myIntent = new Intent(context, InfrastructureIssueActivity.class); myIntent.putExtra(MapParams.STOP_ID, intent.getStringExtra(MapParams.STOP_ID)); myIntent.putExtra(MapParams.STOP_NAME, intent.getStringExtra(MapParams.STOP_NAME)); myIntent.putExtra(MapParams.STOP_CODE, intent.getStringExtra(MapParams.STOP_CODE)); myIntent.putExtra(MapParams.CENTER_LAT, intent.getDoubleExtra(MapParams.CENTER_LAT, 0)); myIntent.putExtra(MapParams.CENTER_LON, intent.getDoubleExtra(MapParams.CENTER_LON, 0)); return myIntent; }
From source file:com.ola.insta.BookingAcivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(getLayoutId());//from w w w . j a v a 2 s . c o m mTextToSpeech = new TextToSpeech(this, this); mUtility = new Utilities(); mProgressDialog = mUtility.GetProcessDialog(this); context = BookingAcivity.this; Intent intent = getIntent(); mCabId = intent.getStringExtra(Constants.CAB_ID); mCabLat = intent.getDoubleExtra(Constants.CAB_LAT, 0.0); mCabLng = intent.getDoubleExtra(Constants.CAB_LANG, 0.0); mCabEta = intent.getLongExtra(Constants.CAB_ETA, 0); init(); }
From source file:eu.power_switch.gui.fragment.configure_geofence.ConfigureGeofenceDialogPage4SummaryFragment.java
@Nullable @Override//from w w w. ja v a 2s . c om public View onCreateView(final LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.dialog_fragment_configure_geofence_page_4, container, false); // BroadcastReceiver to get notifications from background service if room data has changed broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (LocalBroadcastConstants.INTENT_GEOFENCE_LOCATION_CHANGED.equals(intent.getAction())) { currentName = intent.getStringExtra("name"); double latitude = intent.getDoubleExtra("latitude", Geofence.INVALID_LAT); double longitude = intent.getDoubleExtra("longitude", Geofence.INVALID_LON); currentLocation = new LatLng(latitude, longitude); currentGeofenceRadius = intent.getDoubleExtra("geofenceRadius", -1); currentSnapshot = intent.getParcelableExtra("snapshot"); } else if (LocalBroadcastConstants.INTENT_GEOFENCE_ENTER_ACTIONS_CHANGED .equals(intent.getAction())) { currentEnterActions = (ArrayList<Action>) intent.getSerializableExtra("actions"); } else if (LocalBroadcastConstants.INTENT_GEOFENCE_EXIT_ACTIONS_CHANGED .equals(intent.getAction())) { currentExitActions = (ArrayList<Action>) intent.getSerializableExtra("actions"); } updateUi(); notifyConfigurationChanged(); } }; geofenceApiHandler = new GeofenceApiHandler(getActivity()); textViewName = (TextView) rootView.findViewById(R.id.textView_name); textViewLocation = (TextView) rootView.findViewById(R.id.textView_location); imageViewLocationSnapshot = (ImageView) rootView.findViewById(R.id.imageView_locationSnapshot); textViewGeofenceRadius = (TextView) rootView.findViewById(R.id.textView_geofence_radius); textViewEnterActions = (TextView) rootView.findViewById(R.id.textView_enter_actions); textViewExitActions = (TextView) rootView.findViewById(R.id.textView_exit_actions); Bundle args = getArguments(); if (args != null) { if (args.containsKey(ConfigureApartmentGeofenceDialog.APARTMENT_ID_KEY)) { apartmentId = args.getLong(ConfigureApartmentGeofenceDialog.APARTMENT_ID_KEY); } if (args.containsKey(ConfigureGeofenceDialog.GEOFENCE_ID_KEY)) { currentId = args.getLong(ConfigureGeofenceDialog.GEOFENCE_ID_KEY); initializeGeofenceData(currentId); } } updateUi(); return rootView; }
From source file:com.adkdevelopment.earthquakesurvival.ui.DetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.detailed_fragment, container, false); setHasOptionsMenu(true);//from w ww. j a v a2 s . com mUnbinder = ButterKnife.bind(this, rootView); if (getActivity().getIntent().hasExtra(Feature.GEOFENCE)) { ArrayList<String> place = getActivity().getIntent().getStringArrayListExtra(Feature.GEOFENCE); Cursor cursor = null; if (place != null && place.size() > 1) { cursor = getActivity().getContentResolver().query(EarthquakeColumns.CONTENT_URI, null, EarthquakeColumns.URL + "= ?", new String[] { place.get(1) }, null); } if (cursor != null && cursor.getCount() > 0) { cursor.moveToFirst(); long dateMillis = cursor.getLong(cursor.getColumnIndex(EarthquakeColumns.TIME)); double latitude = cursor.getDouble(cursor.getColumnIndex(EarthquakeColumns.LATITUDE)); double longitude = cursor.getDouble(cursor.getColumnIndex(EarthquakeColumns.LONGITUDE)); LatLng latLng = new LatLng(latitude, longitude); mCameraPosition = CameraPosition.builder().target(latLng).zoom(LocationUtils.CAMERA_DEFAULT_ZOOM) .build(); mDistance = getString(R.string.earthquake_distance, LocationUtils.getDistance(latLng, LocationUtils.getLocation(getContext()))); mDate = Utilities.getRelativeDate(dateMillis); mDescription = Utilities .formatEarthquakePlace(cursor.getString(cursor.getColumnIndex(EarthquakeColumns.PLACE))); mLink = cursor.getString(cursor.getColumnIndex(EarthquakeColumns.URL)); mMagnitude = cursor.getDouble(cursor.getColumnIndex(EarthquakeColumns.MAG)); mDepth = cursor.getDouble(cursor.getColumnIndex(EarthquakeColumns.DEPTH)) / 1.6; cursor.close(); setDataToViews(); } } else if (getActivity().getIntent() != null) { Intent input = getActivity().getIntent(); mDate = input.getStringExtra(Feature.DATE); mDescription = input.getStringExtra(Feature.PLACE); mLink = input.getStringExtra(Feature.LINK); mMagnitude = input.getDoubleExtra(Feature.MAGNITUDE, 0.0); mPosition = input.getParcelableExtra(Feature.LATLNG); mDistance = input.getStringExtra(Feature.DISTANCE); mDepth = input.getDoubleExtra(Feature.DEPTH, 0.0); setDataToViews(); } if (mPosition == null) { mPosition = LocationUtils.getLocation(getContext()); } final Bundle mapViewSavedInstanceState = savedInstanceState != null ? savedInstanceState.getBundle(MAP_STATE) : null; if (Utilities.checkPlayServices(getActivity())) { mMapView.onCreate(mapViewSavedInstanceState); mMapView.getMapAsync(this); } if (savedInstanceState != null) { mCameraPosition = savedInstanceState.getParcelable(CAMERA_POSITION); } else { mCameraPosition = CameraPosition.builder().target(mPosition).zoom(LocationUtils.CAMERA_DEFAULT_ZOOM) .build(); } return rootView; }
From source file:com.nextgis.woody.activity.EditActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit); setToolbar(R.id.main_toolbar);// w ww . j av a2s . c o m btLeft = (Button) findViewById(R.id.left_button); btLeft.setOnClickListener(this); btRight = (Button) findViewById(R.id.right_button); btRight.setOnClickListener(this); values = new ContentValues(); Intent intent = this.getIntent(); mFeatureId = intent.getLongExtra(Constants.FEATURE_ID, NOT_FOUND); mapCenter = new GeoPoint(intent.getDoubleExtra(SettingsConstants.KEY_PREF_SCROLL_X, 0), intent.getDoubleExtra(SettingsConstants.KEY_PREF_SCROLL_Y, 0)); if (NOT_FOUND != mFeatureId) { MapBase mapBase = MapBase.getInstance(); NGWVectorLayer vectorLayer = (NGWVectorLayer) mapBase.getLayerByName(Constants.KEY_MAIN); Feature feature = vectorLayer.getFeature(mFeatureId); values = feature.getContentValues(true); } firstStep(); }
From source file:com.javadog.cgeowear.MobileService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null) { final String action = intent.getAction(); if (INTENT_INIT.equals(action)) { cacheName = intent.getStringExtra(EXTRA_CACHE_NAME); geocode = intent.getStringExtra(EXTRA_GEOCODE); final double latitude = intent.getDoubleExtra(EXTRA_LATITUDE, 0d); final double longitude = intent.getDoubleExtra(EXTRA_LONGITUDE, 0d); geocacheLocation = new Location("c:geo"); geocacheLocation.setLatitude(latitude); geocacheLocation.setLongitude(longitude); SharedPreferences userPrefs = PreferenceManager .getDefaultSharedPreferences(getApplicationContext()); useWatchCompass = userPrefs.getBoolean(MessageDataset.KEY_WATCH_COMPASS, true); setupLocationUtils(geocacheLocation); connectGoogleApiClient();//from w ww.j a v a 2 s .c o m } } return START_STICKY; }
From source file:ca.mudar.parkcatcher.ui.activities.MainActivity.java
@Override public void onNewIntent(Intent intent) { initLocation = null;// www .j a v a 2 s. c om Double latitude = intent.getDoubleExtra(Const.INTENT_EXTRA_GEO_LAT, Double.NaN); Double longitude = intent.getDoubleExtra(Const.INTENT_EXTRA_GEO_LNG, Double.NaN); if (!latitude.equals(Double.NaN) && !longitude.equals(Double.NaN)) { initLocation = new Location(Const.LOCATION_PROVIDER_INTENT); initLocation.setLatitude(latitude); initLocation.setLongitude(longitude); isCenterOnMyLocation = false; } else { isCenterOnMyLocation = true; } }
From source file:org.klnusbaum.udj.network.PlayerCommService.java
private void setPlayerData(Intent intent, AccountManager am, Account account) { am.setUserData(account, Constants.PLAYER_NAME_DATA, intent.getStringExtra(Constants.PLAYER_NAME_EXTRA)); am.setUserData(account, Constants.PLAYER_HOSTNAME_DATA, intent.getStringExtra(Constants.PLAYER_OWNER_EXTRA)); am.setUserData(account, Constants.PLAYER_HOST_ID_DATA, intent.getStringExtra(Constants.PLAYER_OWNER_ID_EXTRA)); am.setUserData(account, Constants.PLAYER_LAT_DATA, String.valueOf(intent.getDoubleExtra(Constants.PLAYER_LAT_EXTRA, -100.0))); am.setUserData(account, Constants.PLAYER_LONG_DATA, String.valueOf(intent.getDoubleExtra(Constants.PLAYER_LONG_EXTRA, -100.0))); }