List of usage examples for android.content Intent getSerializableExtra
public Serializable getSerializableExtra(String name)
From source file:app.android.kopper.selectmaparea.MapActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { try {//from ww w .j a v a2 s.c o m super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); final GoogleMap map = mapFragment.getMap(); //todo: map is null when no internet connection ?? if (map != null) { map.getUiSettings().setCompassEnabled(false); map.getUiSettings().setZoomControlsEnabled(true); map.getUiSettings().setIndoorLevelPickerEnabled(false); map.getUiSettings().setRotateGesturesEnabled(false); map.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() { @Override public void onMapLongClick(LatLng latLng) { createMarker(latLng, map); } }); findViewById(R.id.done_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { LinkedList<LatLng> positions = getPositions(); if (positions.size() != 2) Toast.makeText(getApplicationContext(), getString(R.string.error_two_points), Toast.LENGTH_SHORT).show(); else { Intent data = getOrCreateIntent(); data.putExtra(SELECTED_POSITIONS, positions); Serializable nextPage = data .getSerializableExtra(MapActivity.class.getCanonicalName() + "-next"); if (nextPage != null) { try { Intent ii = new Intent(getApplicationContext(), (Class<?>) nextPage); ii.putExtras(data); startActivityForResult(ii, WIZARD_RESULT_CODE); } catch (Exception e) { LogUtil.e(e); } } else { setResult(RESULT_OK, data); finish(); } } } }); LinkedList<LatLng> positions = (LinkedList<LatLng>) getLastCustomNonConfigurationInstance(); if (positions != null) { for (int a = 0; a < positions.size(); a++) { createMarker(positions.get(a), map); } } else { Intent intent = getOrCreateIntent(); Bundle extras = intent.getExtras(); List<LatLng> selectedPoints = (List<LatLng>) extras.get(SELECTED_POSITIONS); if (selectedPoints != null) for (LatLng pos : selectedPoints) createMarker(pos, map); map.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() { @Override public void onCameraChange(CameraPosition arg0) { map.setOnCameraChangeListener(null); if (markers.size() == 2) map.moveCamera(CameraUpdateFactory.newLatLngBounds(new LatLngBounds( markers.get(0).getPosition(), markers.get(1).getPosition()), 40)); if (markers.size() == 1) map.moveCamera(CameraUpdateFactory.newLatLngZoom(markers.get(0).getPosition(), 10)); } }); } } else { //no map ((TextView) findViewById(R.id.message)).setText(getString(R.string.error_map_load)); } } catch (Exception e) { LogUtil.e(e); } }
From source file:de.damdi.fitness.activity.manage_workouts.WorkoutListActivity.java
/** * Handles changed {@link Workout}s(e.g. name was changed in * {@link WorkoutDetailActivity}) and other requests.. */// w ww. j av a 2 s.c o m protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.v(TAG, "onActivityResult()"); if (requestCode == RESULT_WORKOUT) { Log.w(TAG, "RESULT_WORKOUT"); if (resultCode == RESULT_OK) { Workout mWorkout = (Workout) data.getSerializableExtra(WorkoutListActivity.ARG_WORKOUT); this.onWorkoutChanged(mWorkout); return; } if (resultCode == REQUEST_EXIT) { Log.d(TAG, "Requested exit. Will finish acitivty."); finish(); return; } } }
From source file:com.juick.android.MessagesActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { JuickAdvancedApplication.setupTheme(this); JuickAdvancedApplication.maybeEnableAcceleration(this); super.onCreate(savedInstanceState); ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null) supportActionBar.hide();/*from w w w . j a va 2 s . c o m*/ Intent i = getIntent(); restoreData = getLastCustomNonConfigurationInstance(); if (!shouldDelayLaunch() || restoreData != null) { if (messagesSource == null) { messagesSource = (MessagesSource) i.getSerializableExtra("messagesSource"); if (messagesSource == null) { messagesSource = new JuickCompatibleURLMessagesSource(this, "new"); } messagesSource.setContext(this); } initWithMessagesSource(); } }
From source file:com.gb.cwsup.activity.CarAddActivity.java
private void intentisupdate() { Intent intent = getIntent(); TYPE = intent.getStringExtra("type"); if (!TextUtils.isEmpty(TYPE)) { if (TYPE.equals("UPDATE")) { car = (CarBean) intent.getSerializableExtra("CAR"); } else {/* w w w. j a v a2 s. c o m*/ return; } if (car != null) { no.setText(car.getCarno()); color.setText(car.getColor()); type.setText(car.getType()); typemobels.setText(car.getTypemodels()); isdefauls.setSelected(car.isDefault()); } } }
From source file:com.nadmm.airports.wx.AirSigmetFragment.java
protected void showAirSigmetText(Intent intent) { if (getActivity() == null) { return;/* ww w . j a v a 2s. c om*/ } AirSigmet airSigmet = (AirSigmet) intent.getSerializableExtra(NoaaService.RESULT); LinearLayout layout = (LinearLayout) findViewById(R.id.airsigmet_entries_layout); if (layout == null) { return; } layout.removeAllViews(); TextView tv = (TextView) findViewById(R.id.airsigmet_title_msg); if (!airSigmet.entries.isEmpty()) { tv.setText(String.format("%d AIR/SIGMETs reported within %d NM of %s in" + " last %d hours", airSigmet.entries.size(), AIRSIGMET_RADIUS_NM, mStationId, AIRSIGMET_HOURS_BEFORE)); for (AirSigmetEntry entry : airSigmet.entries) { showAirSigmetEntry(layout, entry); } } else { tv.setText(String.format("No AIR/SIGMETs reported within %d NM of %s in" + " last %d hours", AIRSIGMET_RADIUS_NM, mStationId, AIRSIGMET_HOURS_BEFORE)); } tv = (TextView) findViewById(R.id.wx_fetch_time); tv.setText("Fetched on " + TimeUtils.formatDateTime(getActivity(), airSigmet.fetchTime)); tv.setVisibility(View.VISIBLE); stopRefreshAnimation(); setFragmentContentShown(true); }
From source file:org.melato.bus.android.activity.ScheduleActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_SCHEDULE && resultCode == RESULT_OK) { ScheduleId scheduleId = (ScheduleId) data.getSerializableExtra(KEY_SCHEDULE_ID); setSchedule(scheduleId);/*from w w w. j av a 2 s.com*/ } }
From source file:de.grobox.transportr.departures.DeparturesActivity.java
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); location = (WrapLocation) intent.getSerializableExtra(WRAP_LOCATION); if (location == null || location.getLocation() == null) throw new IllegalArgumentException("No Location"); setContentView(R.layout.activity_departures); // Toolbar/* w w w . ja va 2s. c om*/ Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); toolbar.setSubtitle(location.getName()); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } // Swipe to Refresh swipe = findViewById(R.id.swipe); swipe.setColorSchemeResources(R.color.accent); swipe.setDirection(SwipyRefreshLayoutDirection.BOTH); swipe.setDistanceToTriggerSync(getDragDistance(this)); swipe.setOnRefreshListener(direction -> loadMoreDepartures(direction != TOP)); swipe.setEnabled(false); // Departures List adapter = new DepartureAdapter(); list = findViewById(R.id.list); list.setVisibility(INVISIBLE); list.setAdapter(adapter); list.setLayoutManager(new LinearLayoutManager(this)); // Loader Bundle args = getBundle(location.getId(), new Date(), MAX_DEPARTURES); Loader<QueryDeparturesResult> loader = getSupportLoaderManager().initLoader(LOADER_DEPARTURES, args, this); // Progress Bar and Error View progressBar = findViewById(R.id.progressBar); errorLayout = findViewById(R.id.errorLayout); errorText = errorLayout.findViewById(R.id.errorText); errorLayout.findViewById(R.id.errorButton).setOnClickListener(view -> { LceAnimator.showLoading(progressBar, list, errorLayout); getSupportLoaderManager().restartLoader(LOADER_DEPARTURES, args, this).forceLoad(); }); if (loader.isReset()) { LceAnimator.showLoading(progressBar, list, errorLayout); loader.forceLoad(); } if (savedInstanceState != null) { calendar = (Calendar) savedInstanceState.getSerializable(DATE); // re-attach fragment listener List<Fragment> fragments = getSupportFragmentManager().getFragments(); if (fragments != null && fragments.size() > 0 && fragments.get(0) instanceof TimeDateFragment) { ((TimeDateFragment) fragments.get(0)).setTimeDateListener(this); } } }
From source file:de.damdi.fitness.activity.start_training.FExListActivity.java
protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.v(TAG, "onActivityResult()"); if (requestCode == RESULT_WORKOUT) { if (resultCode == RESULT_OK) { // Workout has been changed, so update data mWorkout = (Workout) data.getSerializableExtra(FExListActivity.ARG_WORKOUT); Log.v(TAG, "updating Workout of FExListActivity:\n" + mWorkout.toDebugString()); // update in fragment too FExListFragment fragment = (FExListFragment) getSupportFragmentManager() .findFragmentById(R.id.exercise_list); if (fragment != null) { Log.d(TAG, "updating FExListFragment"); // either notify list fragment if it's there (on tablets) fragment.setWorkout(mWorkout); } else { Log.e(TAG, "Did not find FExListFragment"); }/* w w w .ja v a2 s . c o m*/ } } }
From source file:com.ririjin.adminmobile.fragment.UpdateBasiceFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub moneyDetails = (MoneyDetails) data.getSerializableExtra("moneyDetails"); AppraiserAsses.setText("" + moneyDetails.getActual_borrow_money()); super.onActivityResult(requestCode, resultCode, data); }
From source file:com.simplaapliko.wakeup.sample.ui.MainActivityFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == Dialog.BUTTON_NEGATIVE) { return;//from w ww .j ava 2 s. c o m } Date date = (Date) data.getSerializableExtra(SELECTED_DATE_EXTRA); setAlarm(date); }