List of usage examples for android.os Bundle getDouble
public double getDouble(String key)
From source file:com.mina.breathitout.AnalyzeActivity.java
@Override public void onRestoreInstanceState(Bundle savedInstanceState) { // will be calls after the onStart() super.onRestoreInstanceState(savedInstanceState); dtRMS = savedInstanceState.getDouble("dtRMS"); dtRMSFromFT = savedInstanceState.getDouble("dtRMSFromFT"); dtRMSFromFT_Log = savedInstanceState.getDouble("dtRMSFromFT_Log"); maxAmpDB = savedInstanceState.getDouble("maxAmpDB"); maxAmpFreq = savedInstanceState.getDouble("maxAmpFreq"); breathCount = savedInstanceState.getInt("breathCount"); isBreathing = savedInstanceState.getBoolean("isBreathing"); isInhaling = savedInstanceState.getBoolean("isInhaling"); lastMaxTime = savedInstanceState.getInt("lastMaxTime"); }
From source file:com.alivenet.dmvtaxi.Activity_ConfirmMybooking.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.custome_map); Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar); setSupportActionBar(toolbar);/*from www . ja va 2 s . c om*/ getSupportActionBar().setDisplayHomeAsUpEnabled(true); mPref = Activity_ConfirmMybooking.this.getSharedPreferences(MYPREF, Context.MODE_PRIVATE); mtvpickup_address = (TextView) findViewById(R.id.tv_pickup_address); mtvdrop_address = (TextView) findViewById(R.id.tv_drop_address); mtvestimateprice = (TextView) findViewById(R.id.tv_primerate); mconfirmbooking = (LinearLayout) findViewById(R.id.ll_confirmbooking); cinfirmbooking = (TextView) findViewById(R.id.cinfirmbooking); mivimagecar = (ImageView) findViewById(R.id.iv_carimage); Bundle b = getIntent().getExtras(); Bundle b1 = getIntent().getExtras(); latitude = b1.getDouble("currentlatitude"); longitude = b1.getDouble("currentlongitude"); lat = b.getDouble("distantionLat"); lng = b.getDouble("distantionLng"); prgDialog = new ProgressDialog(this); prgDialog.setMessage("Please wait..."); prgDialog.setCancelable(false); pickup_address = getIntent().getStringExtra("pickup_address"); drop_address = getIntent().getStringExtra("drop_address"); cabId = getIntent().getStringExtra("cabId"); paymentoption = getIntent().getStringExtra("paymentoption"); passenger = getIntent().getStringExtra("passenger"); userId = getIntent().getStringExtra("userId"); cinfirmbooking.setText("CONFIRM BOOKING"); mivimagecar.startAnimation(inFromRightAnimation()); if (pickup_address != null) { mtvpickup_address.setText(pickup_address); mtvdrop_address.setText(drop_address); } if (getIntent() != null) { baseFare = Double.parseDouble(getIntent().getStringExtra("baseFare")); baseFareDistance = Double.parseDouble(getIntent().getStringExtra("baseFareDistance")); perKm = Double.parseDouble(getIntent().getStringExtra("perKm")); waitingCharge = Double.parseDouble(getIntent().getStringExtra("waitingCharge")); am_additioncharge = Double.parseDouble(getIntent().getStringExtra("madditioncharge")); am_telephone_dispatch = Double.parseDouble(getIntent().getStringExtra("mtelephone_dispatch")); am_passengerSurgcharge = Double.parseDouble(getIntent().getStringExtra("mpassengerSurgcharge")); am_luggagecharge = Double.parseDouble(getIntent().getStringExtra("mluggagecharge")); am_airportSurcharge = Double.parseDouble(getIntent().getStringExtra("mairportSurcharge")); am_additionHourcharge = Double.parseDouble(getIntent().getStringExtra("madditionHourcharge")); am_perpassengercharge = Double.parseDouble(getIntent().getStringExtra("mperpassengercharge")); am_snowcharge = Double.parseDouble(getIntent().getStringExtra("msnowcharge")); System.out.println("am_additioncharge==>>" + am_additioncharge); System.out.println("am_telephone_dispatch==>>" + am_telephone_dispatch); System.out.println("am_passengerSurgcharge==>>" + am_passengerSurgcharge); System.out.println("am_luggagecharge==>>" + am_luggagecharge); System.out.println("am_airportSurcharge==>>" + am_airportSurcharge); System.out.println("am_additionHourcharge==>>" + am_additionHourcharge); System.out.println("am_perpassengercharge==>>" + am_perpassengercharge); System.out.println("am_snowcharge==>>" + am_snowcharge); } googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.mapdirection)).getMap(); googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); googleMap.setMyLocationEnabled(true); if (latitude != 0.0d && longitude != 0.0d) { Log.e("longitudeconfirm", "" + longitude); Log.e("latitudeconfirm", "" + latitude); drawMarker(new LatLng(longitude, longitude)); MarkerOptions marker = new MarkerOptions().position(new LatLng(latitude, longitude)).title(""); marker.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)); CameraPosition cameraPosition = new CameraPosition.Builder().target(new LatLng(latitude, longitude)) .zoom(10).build(); googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); googleMap.addMarker(marker); if (ActivityCompat.checkSelfPermission(Activity_ConfirmMybooking.this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(Activity_ConfirmMybooking.this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { } googleMap.setMyLocationEnabled(true); } if (lat != 0.0d && lng != 0.0d) { drawMarkerOnActivity(new LatLng(lat, lng)); googleMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(lat, lng))); // Setting the zoom level in the map on last position is clicked googleMap.animateCamera(CameraUpdateFactory.zoomTo(Float.parseFloat(zoom))); } mconfirmbooking.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (userId != null && latitude != 0.0d && longitude != 0.0d && lat != 0.0d && lng != 0.0d && cabId != null && paymentoption != null) { ride_trip_validate = new Ride_trip_validate(); // ride_trip_validate.Ride_trip_validategetvalue(userId, String.valueOf(latitude), String.valueOf(longitude), String.valueOf(lat), String.valueOf(lng), cabId,paymentoption); ride_trip_validate.execute(); //validateRide(userId, String.valueOf(latitude), String.valueOf(longitude), String.valueOf(lat), String.valueOf(lng), cabId,paymentoption); } } }); cinfirmbooking.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (cinfirmbooking.getText().equals("Share Of The Fare")) { Intent in = new Intent(Activity_ConfirmMybooking.this, SplitAddFrnd.class); in.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(in); } else { if (userId != null && latitude != 0.0d && longitude != 0.0d && lat != 0.0d && lng != 0.0d && cabId != null && paymentoption != null) ride_trip_validate = new Ride_trip_validate(); ride_trip_validate.execute(); } } }); validateGET_TIME(latitude, longitude, lat, lng); }
From source file:de.uhrenbastler.watchcheck.ui.LogDialog.java
public LogDialog(Context context, Bundle logData) { super(context); setContentView(R.layout.log_dialog); setTitle(getContext().getString(R.string.enterLog)); setCancelable(true);// www . j a v a 2s.c o m Button buttonSave = (Button) findViewById(R.id.buttonSave); buttonSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { makeLogEntry(); saved = true; dismiss(); } }); watchId = logData.getInt(ATTR_WATCH_ID); deviation = logData.getDouble(ATTR_DEVIATION); modeNtp = logData.getBoolean(ATTR_MODE_NTP); localTime = (GregorianCalendar) logData.get(ATTR_LOCAL_TIME); ntpTime = (GregorianCalendar) logData.get(ATTR_NTP_TIME); lastLog = (Log) logData.get(ATTR_LAST_LOG); Logger.debug("watchId=" + watchId + ", deviation=" + deviation + ", modeNtp=" + modeNtp + ", localTime=" + localTime.getTime() + ", ntpTime=" + (ntpTime != null ? ntpTime.getTime() : "NULL") + ", lastLog=" + lastLog); TextView textDeviation = (TextView) findViewById(R.id.textViewDeviationValue); DecimalFormat df = new DecimalFormat("#.#"); textDeviation.setText( (deviation > 0 ? "+" : deviation < 0 ? "-" : "+-") + df.format(Math.abs(deviation)) + " sec."); positionSpinner = (Spinner) findViewById(R.id.logSpinnerPosition); ArrayAdapter<?> positionAdapter = ArrayAdapter.createFromResource(getContext(), R.array.positions, android.R.layout.simple_spinner_item); positionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); positionSpinner.setAdapter(positionAdapter); if (lastLog != null && lastLog.getPosition() != null) positionSpinner.setSelection(ArrayUtils.indexOf(POSITIONARR, lastLog.getPosition())); else positionSpinner.setSelection(0); temperatureSpinner = (Spinner) findViewById(R.id.logSpinnerTemperature); ArrayAdapter<?> temperatureAdapter = ArrayAdapter.createFromResource(getContext(), R.array.temperatures, android.R.layout.simple_spinner_item); temperatureAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); temperatureSpinner.setAdapter(temperatureAdapter); if (lastLog != null) temperatureSpinner.setSelection(ArrayUtils.indexOf(TEMPARR, lastLog.getTemperature())); else temperatureSpinner.setSelection(0); comment = (EditText) findViewById(R.id.logComment); startFlag = (CheckBox) findViewById(R.id.logCheckBoxNewPeriod); startFlag.setChecked(lastLog == null); startFlag.setEnabled(lastLog != null); }
From source file:ca.ualberta.cmput301w14t08.geochan.fragments.PostFragment.java
/** * Resumes the fragment, updating the location and textview states accordingly. *//*from w w w . jav a2 s . c o m*/ @Override public void onResume() { super.onResume(); Bundle args = getArguments(); if (args != null) { if (args.containsKey("LATITUDE") && args.containsKey("LONGITUDE")) { Button locButton = (Button) getActivity().findViewById(R.id.location_button); if (args.getString("LocationType") == "CURRENT_LOCATION") { locButton.setText("Location: Set"); } else { Double lat = args.getDouble("LATITUDE"); Double lon = args.getDouble("LONGITUDE"); geoLocation = new GeoLocation(lat, lon); String locationDescription = args.getString("locationDescription"); geoLocation.setLocationDescription(locationDescription); locButton.setText("Location: Set"); } } if (args.containsKey("IMAGE_THUMB") && args.containsKey("IMAGE_FULL")) { imageThumb = args.getParcelable("IMAGE_THUMB"); image = args.getParcelable("IMAGE_FULL"); } } }
From source file:com.microhealthllc.mbmicalc.BmiChart.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.bmichart);//from w w w. j av a 2 s.c o m bar1 = (ColorArcProgressBar) findViewById(R.id.bar1); menumainred = (FloatingActionMenu) findViewById(R.id.menu_red); bmi_note = (TextView) findViewById(R.id.bmi_note); bmitext = (TextView) findViewById(R.id.bmi_display); displayname = (TextView) findViewById(R.id.displayname); displayheight = (TextView) findViewById(R.id.display_height); displayweight = (TextView) findViewById(R.id.display_weight); displaybmi = (TextView) findViewById(R.id.display_bmi); weightter = new ArrayList<>(); db = new DBHandler(this); enteredit_fab = (FloatingActionButton) findViewById(R.id.enter_edit_data); weight_graphfab = (FloatingActionButton) findViewById(R.id.bmi_graph); bmi_logsfab = (FloatingActionButton) findViewById(R.id.bmi_logs); bmi_info = (FloatingActionButton) findViewById(R.id.bmi_info); lastactivty = (TextView) findViewById(R.id.last_activity); recyclerView = (RecyclerView) findViewById(R.id.recycler_view); // unit_settingsfab = (FloatingActionButton) findViewById(R.id.unitsettings); // Enable the Up button // ab.setDisplayHomeAsUpEnabled(true); viewmore = (Button) findViewById(R.id.view_more); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setTitle("BMI Calculator"); } // ab.setDisplayHomeAsUpEnabled(true); //setupWindowAnimations(); setUpNavigationDrawer(); mAdapter = new LogListAdapter(logList); RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext()); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(mAdapter); // *** TOP LINE CHART *** // chartTop = (LineChartView) findViewById(R.id.chart_top); // generateInitialLineData(); sharedPref = this.getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE); Log.i("Get curr time", getDateTimeforLastActivity()); SharedPreferences SP = getSharedPreferences(getString(R.string.preference_file_key), Context.MODE_PRIVATE); metrics = SP.getInt(getString(R.string.metric_settings), 0); viewmore.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(BmiChart.this, LogActivity.class); startActivity(i); } }); if (sharedPref.getString(getString(R.string.last_activity), "").isEmpty()) { lastactivty.setText(sharedPref.getString(getString(R.string.last_activity), "")); } Bundle bundle = getIntent().getExtras(); if (bundle != null) { gotheight = bundle.getDouble("height"); gotWeight = bundle.getDouble("weight"); bmifunc(gotheight, gotWeight); } else { bar1.setCurrentValues(Double.parseDouble(sharedPref.getString(getString(R.string.display_bmi), "0.0"))); // Log.i("getweight gotheight", gotheight+","+gotWeight); bmi_note.setText(sharedPref.getString(getString(R.string.display_note), "normal")); displayheight.setText(sharedPref.getString(getString(R.string.display_height), "0")); displayweight.setText(sharedPref.getString(getString(R.string.display_weight), "0")); displaybmi.setText(sharedPref.getString(getString(R.string.display_bmi), "0.0")); } displayname.setText(SP.getString(getString(R.string.metric_user_name), "User")); enteredit_fab.setOnClickListener(clickListener); weight_graphfab.setOnClickListener(clickListener); bmi_logsfab.setOnClickListener(clickListener); bmi_info.setOnClickListener(clickListener); // unit_settingsfab.setOnClickListener(clickListener); prepareMovieData(); }
From source file:fr.cph.chicago.core.activity.BusActivity.java
@Override protected final void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); App.checkBusData(this); if (!this.isFinishing()) { setContentView(R.layout.activity_bus); ButterKnife.bind(this); if (busStopId == null || busRouteId == null || bound == null || busStopName == null || busRouteName == null || boundTitle == null) { final Bundle extras = getIntent().getExtras(); busStopId = extras.getInt(bundleBusStopId); busRouteId = extras.getString(bundleBusRouteId); bound = extras.getString(bundleBusBound); boundTitle = extras.getString(bundleBusBoundTitle); busStopName = extras.getString(bundleBusStopName); busRouteName = extras.getString(bundleBusRouteName); latitude = extras.getDouble(bundleBusLatitude); longitude = extras.getDouble(bundleBusLongitude); }//from w w w .j a va 2 s. c o m final Position position = new Position(); position.setLatitude(latitude); position.setLongitude(longitude); isFavorite = isFavorite(); mapImage.setColorFilter(grey_5); directionImage.setColorFilter(grey_5); favoritesImageContainer.setOnClickListener(v -> switchFavorite()); if (isFavorite) { favoritesImage.setColorFilter(yellowLineDark); } else { favoritesImage.setColorFilter(grey_5); } scrollView.setOnRefreshListener(() -> new LoadStationDataTask().execute()); streetViewImage.setOnClickListener(new GoogleStreetOnClickListener(latitude, longitude)); mapContainer.setOnClickListener(new GoogleMapOnClickListener(latitude, longitude)); walkContainer.setOnClickListener(new GoogleMapDirectionOnClickListener(latitude, longitude)); busRouteNameView2.setText(busRouteName + " (" + boundTitle + ")"); // Load google street picture and data createGoogleStreetObservable(position.getLatitude(), position.getLongitude()); subscribeToGoogleStreet(streetViewImage, streetViewText); new LoadStationDataTask().execute(); setToolBar(); // Google analytics Util.trackScreen(getApplicationContext(), analyticsBusDetails); } }
From source file:com.androzic.navigation.NavigationService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null) { Intent activity = new Intent(this, MainActivity.class) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); String action = intent.getAction(); if (action == null) return 0; Bundle extras = intent.getExtras(); if (action.equals(NAVIGATE_MAPOBJECT)) { MapObject mo = new MapObject(); mo.name = extras.getString(EXTRA_NAME); mo.latitude = extras.getDouble(EXTRA_LATITUDE); mo.longitude = extras.getDouble(EXTRA_LONGITUDE); mo.proximity = extras.getInt(EXTRA_PROXIMITY); activity.putExtra(MainActivity.LAUNCH_ACTIVITY, HSIActivity.class); contentIntent = PendingIntent.getActivity(this, NOTIFICATION_ID, activity, PendingIntent.FLAG_CANCEL_CURRENT); navigateTo(mo);//from ww w . j av a 2s . c o m } if (action.equals(NAVIGATE_MAPOBJECT_WITH_ID)) { long id = extras.getLong(EXTRA_ID); MapObject mo = application.getMapObject(id); if (mo == null) return 0; activity.putExtra(MainActivity.LAUNCH_ACTIVITY, HSIActivity.class); contentIntent = PendingIntent.getActivity(this, NOTIFICATION_ID, activity, PendingIntent.FLAG_CANCEL_CURRENT); navigateTo(mo); } if (action.equals(NAVIGATE_ROUTE)) { int index = extras.getInt(EXTRA_ROUTE_INDEX); int dir = extras.getInt(EXTRA_ROUTE_DIRECTION, DIRECTION_FORWARD); int start = extras.getInt(EXTRA_ROUTE_START, -1); activity.putExtra(MainActivity.SHOW_FRAGMENT, RouteDetails.class); activity.putExtra("index", index); contentIntent = PendingIntent.getActivity(this, NOTIFICATION_ID, activity, PendingIntent.FLAG_CANCEL_CURRENT); Route route = application.getRoute(index); if (route == null) return 0; navigateTo(route, dir); if (start != -1) setRouteWaypoint(start); } } return START_STICKY; }
From source file:com.spoiledmilk.ibikecph.map.MapActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == ProfileActivity.RESULT_USER_DELETED) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(IbikeApplication.getString("account_deleted")); builder.setPositiveButton(IbikeApplication.getString("close"), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss();//from www . j ava 2 s. c o m } }); dialog = builder.create(); dialog.show(); } else if (resultCode == SearchActivity.RESULT_SEARCH_ROUTE) { if (data != null) { Bundle extras = data.getExtras(); Location start = Util.locationFromCoordinates(extras.getDouble("startLat"), extras.getDouble("startLng")); Location endLocation = Util.locationFromCoordinates(extras.getDouble("endLat"), extras.getDouble("endLng")); if (extras.containsKey("fromName")) source = extras.getString("fromName"); else source = IbikeApplication.getString("current_position"); if (extras.containsKey("toName")) destination = extras.getString("toName"); else destination = ""; new SMHttpRequest().getRoute(start, endLocation, null, MapActivity.this); } } else if (resultCode == SearchAutocompleteActivity.RESULT_AUTOTOCMPLETE_SET) { try { ((AddFavoriteFragment) getSupportFragmentManager().findFragmentById(R.id.leftContainer)) .onActivityResult(requestCode, resultCode, data); } catch (Exception e) { try { ((EditFavoriteFragment) getSupportFragmentManager().findFragmentById(R.id.leftContainer)) .onActivityResult(requestCode, resultCode, data); } catch (Exception ex) { } } } else if (resultCode == RESULT_RETURN_FROM_NAVIGATION) { btnSaveFavorite.setImageResource(R.drawable.drop_pin_selector); pinInfoLayout.setVisibility(View.GONE); mapFragment.pinView.setVisibility(View.GONE); if (mapFragment.pinB != null) { mapFragment.mapView.getOverlayManager().remove(mapFragment.pinB); } if (data != null && data.getExtras() != null && data.getExtras().containsKey("overlaysShown")) { refreshOverlays(data.getIntExtra("overlaysShown", 0)); } } }
From source file:fr.cph.chicago.core.activity.BusActivity.java
@Override public void onRestoreInstanceState(final Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); busStopId = savedInstanceState.getInt(bundleBusStopId); busRouteId = savedInstanceState.getString(bundleBusRouteId); bound = savedInstanceState.getString(bundleBusBound); boundTitle = savedInstanceState.getString(bundleBusBoundTitle); busStopName = savedInstanceState.getString(bundleBusStopName); busRouteName = savedInstanceState.getString(bundleBusRouteName); latitude = savedInstanceState.getDouble(bundleBusLatitude); longitude = savedInstanceState.getDouble(bundleBusLongitude); }
From source file:com.spoiledmilk.cykelsuperstier.break_rote.BreakRouteActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_break_route); textTitle = (TextView) findViewById(R.id.textTitle); textDistance = (TextView) findViewById(R.id.textDistance); textDistanceKm = (TextView) findViewById(R.id.textDistanceKm); btnBreak = (TexturedButton) findViewById(R.id.btnBreak); btnBreak.setBackgroundResource(R.drawable.btn_blue_selector); btnBreak.setTextureResource(R.drawable.btn_pattern_repeteable); btnBreak.setTextColor(Color.WHITE); btnBreak.setTextSize(getResources().getDimension(R.dimen.btn_break_text_size)); textAAddress = (TextView) findViewById(R.id.textAAddress); textBAddress = (TextView) findViewById(R.id.textBAddress); btnRejseplanen = (Button) findViewById(R.id.btnRejseplanen); textARegion = (TextView) findViewById(R.id.textARegion); textBRegion = (TextView) findViewById(R.id.textBRegion); textDistance1 = (TextView) findViewById(R.id.textDistance1); textDistance2 = (TextView) findViewById(R.id.textDistance2); spinner1 = (Spinner) findViewById(R.id.spinner1); spinner2 = (Spinner) findViewById(R.id.spinner2); Bundle data = getIntent().getExtras(); if (data != null) { source = data.getString("source"); destination = data.getString("destination"); distance = data.getInt("distance"); startLoc = Util.locationFromCoordinates(data.getDouble("start_lat"), data.getDouble("start_lon")); endLoc = Util.locationFromCoordinates(data.getDouble("end_lat"), data.getDouble("end_lon")); }//from ww w .j ava 2 s .c o m findViewById(R.id.progressBar).setVisibility(View.VISIBLE); parseStationsFromJson(); ArrayList<String> stations = sortAndGetStationStrings(); IssuesAdapter dataAdapter = new IssuesAdapter(this, stations, R.layout.list_row_stations, R.layout.spinner_layout); spinner1.setAdapter(dataAdapter); if (sortedStations.size() > 0) { selectedStationA = sortedStations.get(0); } else { showRouteNoBreakDialog(); } spinner1.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) { aDistance = -1; findViewById(R.id.progressBar).setVisibility(View.VISIBLE); selectedStationA = sortedStations.get(position); if (metroStations.contains(selectedStationA)) { ((ImageView) findViewById(R.id.imgStation1)).setImageResource(R.drawable.metro_logo_pin); ((ImageView) findViewById(R.id.imgStation2)).setImageResource(R.drawable.metro_logo_pin); iconId = R.drawable.metro_logo_pin; setBikeDistance(selectedStationA, metroStations); } else if (localTrainStations.contains(selectedStationA)) { ((ImageView) findViewById(R.id.imgStation1)).setImageResource(R.drawable.local_train_icon_blue); ((ImageView) findViewById(R.id.imgStation2)).setImageResource(R.drawable.local_train_icon_blue); iconId = R.drawable.local_train_icon_blue; setBikeDistance(selectedStationA, localTrainStations); } else { ((ImageView) findViewById(R.id.imgStation1)).setImageResource(R.drawable.list_subway_icon); ((ImageView) findViewById(R.id.imgStation2)).setImageResource(R.drawable.list_subway_icon); iconId = R.drawable.list_subway_icon; setBikeDistance(selectedStationA, sTrainStations); } IssuesAdapter dataAdapterB = new IssuesAdapter(BreakRouteActivity.this, selectedStationA.getBStationsString(), R.layout.list_row_stations, R.layout.spinner_layout); spinner2.setAdapter(dataAdapterB); if (selectedStationA.BStations == null || selectedStationA.BStations.size() == 0) showRouteNoBreakDialog(); else { selectedStationB = selectedStationA.BStations.get(0); new SMHttpRequest().getRoute(selectedStationA.loc, startLoc, null, BreakRouteActivity.this); } } @Override public void onNothingSelected(AdapterView<?> parentView) { // your code here } }); spinner2.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) { if (selectedStationA.BStations == null || selectedStationA.BStations.size() == 0) showRouteNoBreakDialog(); else { selectedStationB = selectedStationA.BStations.get(position); // aDistance = -1; findViewById(R.id.progressBar).setVisibility(View.VISIBLE); new SMHttpRequest().getRoute(selectedStationB.loc, endLoc, null, BreakRouteActivity.this); } } @Override public void onNothingSelected(AdapterView<?> parentView) { // your code here } }); }