List of usage examples for android.content Intent getSerializableExtra
public Serializable getSerializableExtra(String name)
From source file:com.johnny.gank.ui.activity.PictureActivity.java
private void parseIntentAndInitAdapter() { Intent intent = getIntent(); if (null == intent) return;// ww w . j a va2s . co m String singlePicUrl = intent.getStringExtra(EXTRA_URL_SINGLE_PIC); if (!TextUtils.isEmpty(singlePicUrl)) { Date publishAt = (Date) intent.getSerializableExtra(EXTRA_PUBLISH_SINGLE_PIC); List<GankNormalItem> itemList = new ArrayList<>(1); GankNormalItem item = new GankNormalItem(); item.url = singlePicUrl; item.publishedAt = publishAt; itemList.add(item); mPagerAdapter.initList(itemList); setTitle(sDateFormatter.format(publishAt)); } else { int pageIndex = intent.getIntExtra(EXTRA_PAGE_INDEX, -1); String picId = intent.getStringExtra(EXTRA_PIC_ID); if (-1 != pageIndex) { mInitPicId = picId; loadPictureList(pageIndex); } } }
From source file:de.damdi.fitness.activity.create_workout.ExerciseTypeListActivity.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(ExerciseTypeListActivity.ARG_WORKOUT); }//from w ww . j a v a2s.c om } }
From source file:edu.ucsb.cs.cs185.inspirante.collectiondetails.CollectionDetailsActivity.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == ImagePicker.RESULT_CODE_ITEMS) { if (data != null && requestCode == IMAGE_PICKER) { ArrayList<ImageItem> images = (ArrayList<ImageItem>) data .getSerializableExtra(ImagePicker.EXTRA_RESULT_ITEMS); ItemCards.Card card = ItemCards.getInstance(getApplicationContext()).cards.get(mCardIndex); card.addImages(images);// ww w . ja v a 2 s . co m card.writeToDB(); mAdapter.notifyDataSetChanged(); this.onPrepareOptionsMenu(mToolbar.getMenu()); } else { Toast.makeText(this, "No data", Toast.LENGTH_SHORT).show(); } } else if (requestCode == EDIT_RESULT) { if (resultCode == RESULT_OK) { this.finish(); } } }
From source file:com.androidquery.simplefeed.activity.ImageActivity.java
@Override protected void init(Bundle savedInstanceState) { initView();//from w w w.j a v a2s . c o m Intent intent = getIntent(); if (intent == null) return; String url = intent.getStringExtra("url"); if (url == null) return; item = (FeedItem) intent.getSerializableExtra("item"); if (item != null) { if ("photo".equals(item.getType())) { url = handle.getNetworkUrl(url); } if (item.getSource() == null) { item.setSource(url); item.setItemName(item.getDesc()); } photos.add(item); adapter.notifyDataSetChanged(); boolean fetchAlbum = intent.getBooleanExtra("album", true); String album = extractAlbum(item); if (fetchAlbum && album != null) { ajaxPhoto(album, HALF_DAY); } } }
From source file:aenadon.wienerlinienalarm.activities.MainActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { tabAdapter.notifyDataSetChanged(); if (data != null) { AlarmType alarmType = (AlarmType) data.getSerializableExtra(Keys.Extra.ALARM_TYPE); tabContainer.setCurrentItem(alarmType.ordinal()); }/*from w w w. j av a 2 s . c om*/ } if (data != null) { String snackbarMessage = data.getStringExtra(Keys.Extra.SNACKBAR_MESSAGE); if (snackbarMessage != null) { Snackbar.make(findViewById(R.id.fab_main), snackbarMessage, Snackbar.LENGTH_LONG).show(); } } super.onActivityResult(requestCode, resultCode, data); }
From source file:de.grobox.liberario.TripsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_trips); getActionBar().setDisplayHomeAsUpEnabled(true); final TableLayout main = (TableLayout) findViewById(R.id.activity_trips); // add horizontal divider at top main.addView(LiberarioUtils.getDivider(this)); Intent intent = getIntent(); trips = (QueryTripsResult) intent.getSerializableExtra("de.schildbach.pte.dto.QueryTripsResult"); // also get locations, because the trip locations are sometimes still ambiguous from = (Location) intent.getSerializableExtra("de.schildbach.pte.dto.Trip.from"); to = (Location) intent.getSerializableExtra("de.schildbach.pte.dto.Trip.to"); setHeader();//w w w. j av a 2 s . co m addTrips(main, trips.trips); }
From source file:de.grobox.liberario.activities.MapStationsActivity.java
private void setupMap() { mMapView = new MapView(this, 256); mMapView.setClickable(true);//w ww . j a v a 2s .c o m mMapView.setBuiltInZoomControls(true); mMapView.setMultiTouchControls(true); mMapView.setTilesScaledToDpi(true); ((LinearLayout) findViewById(R.id.root)).addView(mMapView); Intent intent = getIntent(); List<Location> locations = (ArrayList<Location>) intent .getSerializableExtra("List<de.schildbach.pte.dto.Location>"); Location myLoc = (Location) intent.getSerializableExtra("de.schildbach.pte.dto.Location"); int minLat = Integer.MAX_VALUE; int maxLat = Integer.MIN_VALUE; int minLon = Integer.MAX_VALUE; int maxLon = Integer.MIN_VALUE; int count = 0; // find location area and mark locations on map for (Location loc : locations) { if (loc.hasLocation()) { maxLat = Math.max(loc.lat, maxLat); minLat = Math.min(loc.lat, minLat); maxLon = Math.max(loc.lon, maxLon); minLon = Math.min(loc.lon, minLon); count += 1; markLocation(loc); } } // include my location in center calculation if available if (myLoc != null) { maxLat = Math.max(myLoc.lat, maxLat); minLat = Math.min(myLoc.lat, minLat); maxLon = Math.max(myLoc.lon, maxLon); minLon = Math.min(myLoc.lon, minLon); count += 1; } final GeoPoint center = new GeoPoint((maxLat + minLat) / 2, (maxLon + minLon) / 2); IMapController mapController = mMapView.getController(); mapController.setCenter(center); mapController.setZoom(18); if (count > 1) { mapController.zoomToSpan(maxLat - minLat, maxLon - minLon); } if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { setupGPS(myLoc); } }
From source file:eu.power_switch.gui.fragment.configure_scene.ConfigureSceneDialogTabbedPage2SetupFragment.java
@Nullable @Override//from ww w.j ava 2s. c o m public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.dialog_fragment_configure_scene_page_2, 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) { currentName = intent.getStringExtra("name"); rooms.clear(); rooms.addAll((ArrayList<Room>) intent.getSerializableExtra("selectedReceivers")); updateSceneItemList(); notifyConfigurationChanged(); } }; rooms = new ArrayList<>(); customRecyclerViewAdapter = new CustomRecyclerViewAdapter(getActivity(), rooms); recyclerViewSelectedReceivers = (RecyclerView) rootView.findViewById(R.id.recyclerview_list_of_receivers); recyclerViewSelectedReceivers.setAdapter(customRecyclerViewAdapter); StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager( getResources().getInteger(R.integer.scene_grid_span_count), StaggeredGridLayoutManager.VERTICAL); recyclerViewSelectedReceivers.setLayoutManager(layoutManager); Bundle args = getArguments(); if (args != null && args.containsKey(ConfigureSceneDialog.SCENE_ID_KEY)) { currentId = args.getLong(ConfigureSceneDialog.SCENE_ID_KEY); initializeSceneData(currentId); } checkSetupValidity(); return rootView; }
From source file:co.lmejia.iglesia.AssistanceListActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(TAG, "onActivityResult"); Assistance assistance_new; String message = ""; if (requestCode == ASSISTANCE_REQUEST_CODE && data != null) { if (data.hasExtra(Assistance.TAG)) { assistance_new = (Assistance) data.getSerializableExtra(Assistance.TAG); if (resultCode == AssistanceActivity.RESULT_OK) { mAdapter.addItem(assistance_new, 0); message = "Se agreg una asistencia"; } else if (resultCode == AssistanceActivity.RESULT_EDIT) { mAdapter.updateItem(assistance_new, positionEdit); message = "Se modific una asistencia"; }/*from www .j a v a 2 s . c o m*/ Toast t = Toast.makeText(this, message, Toast.LENGTH_SHORT); t.show(); } } }
From source file:org.ado.minesync.service.UploadDownloadService.java
@Override protected void onHandleIntent(Intent intent) { ALog.d(TAG, "onHandleIntent. intent[" + intent + "]."); removeCallbacks();/*from ww w .ja v a 2 s . c om*/ handler.postDelayed(sendUpdatesToUI, 5000); operationTitle = intent.getStringExtra(OPERATION_TITLE); try { startProcess((OperationTypeEnum) intent.getSerializableExtra(OPERATION_TYPE), intent.getStringExtra(OPERATION_WORLD_NAME), (SyncTypeEnum) intent.getSerializableExtra(OPERATION_WORLD_SYNC_TYPE)); } catch (MineSyncException e) { ExceptionNotifier.notifyException(getApplicationContext(), e); } catch (DropboxAccountException e) { ExceptionNotifier.notifyException(getApplicationContext(), e); } }