List of usage examples for android.os Bundle getSerializable
@Override
@Nullable
public Serializable getSerializable(@Nullable String key)
From source file:com.noveogroup.android.facebook.FacebookShareDialogFragment.java
private void onHandleArguments(final Bundle arguments) { if (arguments.containsKey(EXTRA_PAYLOAD)) { payload = (Payload) arguments.getSerializable(EXTRA_PAYLOAD); }/* ww w. j ava 2 s . c o m*/ }
From source file:com.robwilliamson.healthyesther.edit.ScoreEventActivity.java
@Override protected void resumeFromIntentExtras(@Nonnull Bundle bundle) { final EventTable.Row event = Utils .checkNotNull((EventTable.Row) bundle.getSerializable(HealthDatabase.EVENT_TABLE.getName())); if (!event.getTypeId().equals(EventTypeTable.HEALTH.getId())) { throw new EventTypeTable.BadEventTypeException(EventTypeTable.HEALTH, event.getTypeId().getId()); }/*w w w . ja v a 2 s. c om*/ getEventFragment().setRow(event); getExecutor().perform(new TransactionExecutor.Operation() { @Override public void doTransactionally(@Nonnull final Database database, @Nonnull Transaction transaction) { HealthScoreEventTable.Row[] scoreEvents = HealthDatabase.HEALTH_SCORE_EVENT_TABLE.select(database, WhereContains.foreignKey(HealthScoreEventTable.EVENT_ID, event.getConcretePrimaryKey().getId())); final Map<HealthScoreTable.Row, HealthScoreEventTable.Row> scores = new HashMap<>(); for (HealthScoreEventTable.Row scoreEvent : scoreEvents) { HealthScoreTable.Row scoreType = HealthDatabase.HEALTH_SCORE_TABLE.select1(database, WhereContains.foreignKey(HealthScoreTable._ID, scoreEvent.getConcretePrimaryKey().getHealthScoreId().getId())); scores.put(scoreType, scoreEvent); } runOnUiThread(new Runnable() { @Override public void run() { EditScoreEventGroupFragment eventGroupFragment = getScoreGroupFragment(); eventGroupFragment.clearScoreFragments(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); for (Map.Entry<HealthScoreTable.Row, HealthScoreEventTable.Row> entry : scores.entrySet()) { EditScoreEventFragment fragment = EditScoreEventFragment.newInstance(entry); eventGroupFragment.addFragment(fragment, transaction); } transaction.commit(); } }); } }); }
From source file:ca.ualberta.cmput301.as1.czervos_notes.StatsActivity.java
/** * Processes data in received bundle then displays it. *//*from ww w.j a v a 2s.co m*/ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_stats); // Show the Up button in the action bar. setupActionBar(); /* Receives bundle */ Intent intent = this.getIntent(); Bundle bundle = intent.getExtras(); counter = (CounterModel) bundle.getSerializable("CounterStats"); // Gets list of calendars from counter timeList = counter.getTimeList(); /* Retrieves Counter Statistics from Calendar Data */ setMonthStats(timeList); setWeekStats(timeList); setDayStats(timeList); setHourStats(timeList); /* Draws ListView of counts */ statsListView = (ListView) findViewById(R.id.listview_stats_list); customStatsAdapter = new CustomStatsAdapter(this, statsList, statsCountsList); // Draws ListView using custom adapter statsListView.setAdapter(customStatsAdapter); /* Sets Statistics Screen Title */ statsTitle = (TextView) findViewById(R.id.textview_stats_title); statsTitle.setText(counter.getCounterName() + " Counter Statistics"); }
From source file:com.robwilliamson.healthyesther.fragment.edit.EditMedicationFragment.java
/** * Called when the fragment's activity has been created and this * fragment's view hierarchy instantiated. It can be used to do final * initialization once these pieces are in place, such as retrieving * views or restoring state. It is also useful for fragments that use * {@link #setRetainInstance(boolean)} to retain their instance, * as this callback tells the fragment when it is fully associated with * the new activity instance. This is called after {@link #onCreateView} * and before {@link #onViewStateRestored(Bundle)}. * * @param savedInstanceState If the fragment is being re-created from * a previous saved state, this is the state. *///from w w w. j av a 2s .c o m @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (savedInstanceState != null) { //noinspection unchecked mNameToRowMap = (Map<String, MedicationTable.Row>) savedInstanceState.getSerializable(NAME_TO_ROW_MAP); } }
From source file:dev.ronlemire.data.MainActivity.java
@Override protected void onRestoreInstanceState(Bundle inState) { super.onRestoreInstanceState(inState); messageTextView.setText(inState.getSerializable("message").toString()); }
From source file:edu.asu.cse535.assignment3.MainActivity.java
public void setHandlerForService() { handler = new Handler() { @Override// w w w . j a v a 2s. c om public void handleMessage(Message msg) { //ideally do it in service. Because extra filling of array may be avoided.But // check if the built message will be sent to the queue if stopself is called // before sendig the message. Log.w(this.getClass().getSimpleName(), "Message received and stopping service"); Bundle b = msg.getData(); ActivityData activityData = (ActivityData) b.getSerializable("ActivityData"); Log.w(this.getClass().getSimpleName(), "The data for " + activityData.getActivity() + " will be added to database"); activityDatabaseHandler.addActivityToDatabase(activityData); stopAccService(); notifyCompletion(); Toast.makeText(MainActivity.this, "Activity added to Database", Toast.LENGTH_SHORT).show(); new ActivityPublishHelper(activityData, getApplicationContext()); } }; }
From source file:com.chatwingsdk.fragments.ProfileFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mDelegate.inject(this); Bundle arguments = getArguments(); if (arguments == null) { dismiss();/*w w w .jav a 2 s . c o m*/ return; } final ViewProfileEvent profile = (ViewProfileEvent) arguments.getSerializable(PROFILE_KEY); mAvatar = (RatioImageView) getView().findViewById(R.id.profile_photo); mSmallAvatar = (RatioImageView) getView().findViewById(R.id.profile_small_photo); mName = (TextView) getView().findViewById(R.id.profile_name); mViewPager = (ViewPager) getView().findViewById(R.id.pager); mReplyButton = (ImageButton) getView().findViewById(R.id.profile_reply); if (profile.isDenyReply()) { mReplyButton.setVisibility(View.GONE); } else { mReplyButton.setVisibility(View.VISIBLE); } mAvatar.setImageUrl(profile.getAvatarUrl(), mVolleyManager.getImageLoader()); mSmallAvatar.setImageUrl(profile.getAvatarUrl(), mVolleyManager.getImageLoader()); //Load fragments PagerAdapter adapter = buildAdapter(profile); mViewPager.setAdapter(adapter); TabPageIndicator indicator = (TabPageIndicator) getView().findViewById(R.id.indicator); indicator.setViewPager(mViewPager); mName.setText(profile.getUserName()); //Reply listener mReplyButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mDelegate.showConversation( new CreateConversationParams.SimpleUser(profile.getLoginId(), profile.getUserType())); dismiss(); } }); }
From source file:de.damdi.fitness.activity.create_workout.ExerciseTypeListActivity.java
/** * Restores the state of this Activity, e.g. after screen orientation * changed./*from ww w. j a v a2 s . c o m*/ */ @Override public void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); mWorkout = (Workout) savedInstanceState.getSerializable(ARG_WORKOUT); }
From source file:com.rnd.snapsplit.view.DialogFragmentFingerprintAuthentication.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { getDialog().setTitle(getString(R.string.sign_in)); View v = inflater.inflate(R.layout.fingerprint_dialog_container, container, false); Bundle bundle = this.getArguments(); pr = (PaymentRequest) bundle.getSerializable("pr"); final TextView amount = (TextView) v.findViewById(R.id.amount_value); String amountValue = "HKD" + String.format("%.2f", pr.getShareAmount()); amount.setText(amountValue);// w w w . j a v a 2s . c om final TextView receipient = (TextView) v.findViewById(R.id.receipient_value); receipient.setText((String) pr.getRequestorName() + " - " + pr.getRequestorPhoneNumber()); mCancelButton = (Button) v.findViewById(R.id.cancel_button); mCancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dismiss(); } }); mSecondDialogButton = (Button) v.findViewById(R.id.second_dialog_button); mSecondDialogButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mStage == Stage.FINGERPRINT) { goToBackup(); } else { verifyPassword(); } } }); mFingerprintContent = v.findViewById(R.id.fingerprint_container); mBackupContent = v.findViewById(R.id.backup_container); mPassword = (EditText) v.findViewById(R.id.password); mPassword.setOnEditorActionListener(this); mPasswordDescriptionTextView = (TextView) v.findViewById(R.id.password_description); //mFingerprintContent mUseFingerprintFutureCheckBox = (CheckBox) v.findViewById(R.id.use_fingerprint_in_future_check); mNewFingerprintEnrolledTextView = (TextView) v.findViewById(R.id.new_fingerprint_enrolled_description); mFingerprintUiHelper = new FingerprintUiHelper(mContext.getSystemService(FingerprintManager.class), (ImageView) v.findViewById(R.id.fingerprint_icon), (TextView) v.findViewById(R.id.fingerprint_status), this); updateStage(); // If fingerprint authentication is not available, switch immediately to the backup // (password) screen. if (!mFingerprintUiHelper.isFingerprintAuthAvailable()) { goToBackup(); } return v; }
From source file:de.grobox.liberario.locations.LocationFragment.java
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); activity = (NewMapActivity) getActivity(); Bundle args = getArguments(); location = (WrapLocation) args.getSerializable(WRAP_LOCATION); if (location == null) throw new IllegalArgumentException("No location"); View v = inflater.inflate(R.layout.fragment_location, container, false); getComponent().inject(this); // Location/*from www. ja v a2s .c om*/ locationIcon = (ImageView) v.findViewById(R.id.locationIcon); locationName = (TextView) v.findViewById(R.id.locationName); OnClickListener locationClick = new OnClickListener() { @Override public void onClick(View view) { activity.zoomTo(location); } }; locationIcon.setOnClickListener(locationClick); locationName.setOnClickListener(locationClick); // Lines linesLayout = (ViewGroup) v.findViewById(R.id.linesLayout); linesLayout.setVisibility(GONE); // Location Info locationInfo = (TextView) v.findViewById(R.id.locationInfo); showLocation(); if (location.getLocation().type == COORD) { OsmReverseGeocoder geocoder = new OsmReverseGeocoder(this); geocoder.findLocation(location.getLocation()); } // Departures Button departuresButton = (Button) v.findViewById(R.id.departuresButton); if (location.hasId()) { departuresButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(getContext(), DeparturesActivity.class); intent.putExtra(WRAP_LOCATION, location); startActivity(intent); } }); } else { departuresButton.setVisibility(GONE); } // Nearby Stations nearbyStationsButton = (Button) v.findViewById(R.id.nearbyStationsButton); nearbyStationsProgress = (ProgressBar) v.findViewById(R.id.nearbyStationsProgress); nearbyStationsButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { nearbyStationsButton.setVisibility(INVISIBLE); nearbyStationsProgress.setVisibility(VISIBLE); activity.findNearbyStations(location.getLocation()); } }); // Share Location Button shareButton = (Button) v.findViewById(R.id.shareButton); shareButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { startGeoIntent(getContext(), location.getLocation()); } }); return v; }