List of usage examples for android.os Bundle getSerializable
@Override
@Nullable
public Serializable getSerializable(@Nullable String key)
From source file:edu.mecc.race2ged.activities.HomeActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); //For backwards compat. For some reason, the Drawer Glyph does not show up on older versions //unless these lines are added manually. Even though the ActionBarDrawerToggle calls them... getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_drawer); NavigationDrawerFragment mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager() .findFragmentById(R.id.navigation_drawer); // Set up the drawer. mNavigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); GEDApplication.setStoredContext(this); if (savedInstanceState == null) { mRegion = (Region) getIntent().getExtras().getSerializable(ARG_REGION); } else {/*from w w w . ja v a 2 s .c o m*/ mRegion = (Region) savedInstanceState.getSerializable(ARG_REGION); } populateCards(); getSupportFragmentManager().beginTransaction().add(R.id.container, CardListFragment.newInstance(mHomeCards)) .commit(); try { navTitles.addAll(Arrays.asList(getResources().getStringArray(R.array.navPrimaryTitles))); navTitles.addAll(Arrays.asList(getResources().getStringArray(R.array.navSecondaryTitles))); } catch (Resources.NotFoundException e) { Log.e("HomeActivity", "Could not add nav titles to list. - " + e.getMessage()); } }
From source file:pt.up.mobile.syncadapter.SigarraSyncAdapter.java
@TargetApi(8) @Override/* w ww .jav a 2 s . co m*/ public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { boolean listeningToProblems = false; try { if (extras.getBoolean(SINGLE_REQUEST)) { listeningToProblems = true; Log.d(getClass().getSimpleName(), "Fetching Sigarra"); if (SUBJECT.equals(extras.getString(REQUEST_TYPE))) { getSubject(account, extras.getString(CODE), syncResult); return; } if (PROFILE.equals(extras.getSerializable(REQUEST_TYPE))) { getProfile(account, extras.getString(PROFILE_CODE), extras.getString(PROFILE_TYPE), syncResult); return; } if (EXAMS.equals(extras.getSerializable(REQUEST_TYPE))) { syncExams(account, syncResult); return; } if (ACADEMIC_PATH.equals(extras.getSerializable(REQUEST_TYPE))) { syncAcademicPath(account, syncResult); return; } if (PROFILE_PIC.equals(extras.getSerializable(REQUEST_TYPE))) { syncProfilePic(extras.getString(CODE), account, syncResult); return; } if (TUITION.equals(extras.getSerializable(REQUEST_TYPE))) { syncTuition(account, syncResult); return; } if (TEACHING_SERVICE.equals(extras.getSerializable(REQUEST_TYPE))) { syncTeachingService(account, syncResult); return; } if (PRINTING_QUOTA.equals(extras.getSerializable(REQUEST_TYPE))) { syncPrintingQuota(account, syncResult); return; } if (NOTIFICATIONS.equals(extras.getSerializable(REQUEST_TYPE))) { syncNotifications(account, syncResult); return; } if (CANTEENS.equals(extras.getSerializable(REQUEST_TYPE))) { syncCanteens(account, syncResult); return; } if (SCHEDULE.equals(extras.getSerializable(REQUEST_TYPE))) { getSchedule(account, extras.getString(SCHEDULE_CODE), extras.getString(SCHEDULE_TYPE), extras.getString(SCHEDULE_INITIAL), extras.getString(SCHEDULE_FINAL), SyncStates.PRUNE, syncResult); return; } } else { Log.d(getClass().getSimpleName(), "Sync Sigarra"); syncProfiles(account, syncResult); syncExams(account, syncResult); syncTuition(account, syncResult); syncPrintingQuota(account, syncResult); syncSchedule(account, syncResult); syncNotifications(account, syncResult); syncCanteens(account, syncResult); final User user = AccountUtils.getUser(getContext(), account.name); if (user.getType().equals(SifeupAPI.STUDENT_TYPE)) { syncAcademicPath(account, syncResult); syncSubjects(account, syncResult); } else { syncTeachingService(account, syncResult); } } } catch (IOException e) { syncResult.stats.numIoExceptions++; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) syncResult.delayUntil = 3600; if (listeningToProblems) broadcastManager.sendBroadcast( new Intent(SIGARRASYNCADAPTER_STATUS).putExtra(SIGARRASYNCADAPTER_STATUS, NETWORK_ERROR)); e.printStackTrace(); } catch (AuthenticationException e) { e.printStackTrace(); mAccountManager.invalidateAuthToken(Constants.ACCOUNT_TYPE, null); syncResult.stats.numAuthExceptions++; if (listeningToProblems) broadcastManager.sendBroadcast(new Intent(SIGARRASYNCADAPTER_STATUS) .putExtra(SIGARRASYNCADAPTER_STATUS, AUTHENTICATION_ERROR)); } catch (Exception e) { if (listeningToProblems) broadcastManager.sendBroadcast( new Intent(SIGARRASYNCADAPTER_STATUS).putExtra(SIGARRASYNCADAPTER_STATUS, GENERAL_ERROR)); e.printStackTrace(); LogUtils.trackException(getContext(), e, null, true); } }
From source file:com.zyascend.RecompileToDo.view.tasks.TasksActivity.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tasks_act);/* w w w . java 2s .c o m*/ ButterKnife.bind(this); setSupportActionBar(toolbar); ActionBar ab = getSupportActionBar(); ab.setHomeAsUpIndicator(R.drawable.ic_menu); ab.setDisplayHomeAsUpEnabled(true); drawerLayout.setStatusBarBackground(R.color.colorPrimaryDark); if (navView != null) { setupDrawerContent(navView); } TasksFragment tasksFragment = (TasksFragment) getSupportFragmentManager() .findFragmentById(R.id.contentFrame); if (tasksFragment == null) { tasksFragment = TasksFragment.newInstance(); ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), tasksFragment, R.id.contentFrame); } TasksRepository mTaskRepository = TasksRepository.getInstance(TaskDataAchiever.getInstance(this)); mPresenter = new TasksPresenterAchiever(mTaskRepository, tasksFragment); // ?? if (savedInstanceState != null) { TasksFilterType currentFiltering = (TasksFilterType) savedInstanceState .getSerializable(CURRENT_FILTERING_KEY); mPresenter.setFiltering(currentFiltering); } }
From source file:net.reichholf.dreamdroid.activities.ServiceListActivity.java
@SuppressWarnings("unchecked") @Override// w w w . java2s. c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String mode = getIntent().getAction(); if (mode.equals(Intent.ACTION_PICK)) { mPickMode = true; } else { mPickMode = false; } String ref = DreamDroid.SP.getString(DreamDroid.PREFS_KEY_DEFAULT_BOUQUET_REF, "default"); String name = DreamDroid.SP.getString(DreamDroid.PREFS_KEY_DEFAULT_BOUQUET_NAME, (String) getText(R.string.bouquet_overview)); mReference = getDataForKey(Event.SERVICE_REFERENCE, ref); mName = getDataForKey(Event.SERVICE_NAME, name); if (savedInstanceState != null) { mIsBouquetList = savedInstanceState.getBoolean("isBouquetList", true); mHistory = (ArrayList<ExtendedHashMap>) savedInstanceState.getSerializable("history"); } else { mIsBouquetList = DreamDroid.SP.getBoolean(DreamDroid.PREFS_KEY_DEFAULT_BOUQUET_IS_LIST, true); mHistory = new ArrayList<ExtendedHashMap>(); ExtendedHashMap map = new ExtendedHashMap(); map.put(Event.SERVICE_REFERENCE, mReference); map.put(Event.SERVICE_NAME, mName); mHistory.add(map); } setAdapter(); reload(); }
From source file:com.bushstar.kobocoin_android_wallet.ui.SendCoinsFragment.java
private void restoreInstanceState(final Bundle savedInstanceState) { paymentIntent = savedInstanceState.getParcelable("payment_intent"); state = (State) savedInstanceState.getSerializable("state"); validatedAddress = savedInstanceState.getParcelable("validated_address"); if (savedInstanceState.containsKey("sent_transaction_hash")) { sentTransaction = wallet//from ww w . ja va 2s . c o m .getTransaction((Sha256Hash) savedInstanceState.getSerializable("sent_transaction_hash")); sentTransaction.getConfidence().addEventListener(sentTransactionConfidenceListener); } if (savedInstanceState.containsKey("direct_payment_ack")) directPaymentAck = savedInstanceState.getBoolean("direct_payment_ack"); }
From source file:com.sbgapps.scoreit.ui.ScoreItActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ButterKnife.inject(this); mGraphContainer = (FrameLayout) findViewById(R.id.graph_container); mGameHelper = new GameHelper(this); mGameHelper.loadLaps();//from w ww.j a v a 2 s.c om mCurrentGame = mGameHelper.getPlayedGame(); setTitle(); // Init fragments reloadFragments(false); if (null != savedInstanceState) { mLap = (Lap) savedInstanceState.getSerializable("lap"); mIsEdited = savedInstanceState.getBoolean("edited"); if (mIsEdited) { int position = savedInstanceState.getInt("position"); mEditedLap = mGameHelper.getLaps().get(position); } } if (null != mLap) setActionButtonColor(); initLapContainer(); initDrawer(); initActionButton(); }
From source file:com.supremainc.biostar2.user.MyProfileFragment.java
private boolean initValue(Bundle savedInstanceState) { if (mUserInfo == null) { mUserInfo = mUserDataProvider.getLoginUserInfo(); }//from w w w . j a v a 2s .com if (savedInstanceState != null) { int photoMode = savedInstanceState.getInt("photoStatus"); mPhotoStatus = PhotoStatus.values()[photoMode]; if (mUserInfo == null) { mUserInfo = (User) savedInstanceState.getSerializable(User.TAG); } if (BuildConfig.DEBUG) { Log.e(TAG, "mPhotoStatus restore:" + mPhotoStatus); } } mInvalidChecker = new InvalidChecker(mPopup); createUser(); if (mUserInfo == null) { return false; } mPinSwitch = mLayout.getPinSwitchView(); setView(); return true; }
From source file:cc.mintcoin.wallet.ui.SendCoinsFragment.java
private void restoreInstanceState(final Bundle savedInstanceState) { paymentIntent = (PaymentIntent) savedInstanceState.getParcelable("payment_intent"); state = (State) savedInstanceState.getSerializable("state"); validatedAddress = savedInstanceState.getParcelable("validated_address"); if (savedInstanceState.containsKey("sent_transaction_hash")) { sentTransaction = wallet/*from w ww.java 2 s .c om*/ .getTransaction((Sha256Hash) savedInstanceState.getSerializable("sent_transaction_hash")); sentTransaction.getConfidence().addEventListener(sentTransactionConfidenceListener); } if (savedInstanceState.containsKey("direct_payment_ack")) directPaymentAck = savedInstanceState.getBoolean("direct_payment_ack"); }
From source file:com.kjsaw.alcosys.ibacapp.IBAC.java
protected void initOthers() { MODE m;/* w w w. java 2s . c o m*/ Bundle extras = getIntent().getExtras(); if (extras != null) m = (MODE) extras.getSerializable("mode"); else m = MODE.SAMPLING; CreateComponents(m); }
From source file:com.nextgis.maplibui.activity.ModifyAttributesActivity.java
protected void createView(final IGISApplication app, Bundle savedState) { //create and fill controls Bundle extras = getIntent().getExtras(); if (extras != null) { int layerId = extras.getInt(KEY_LAYER_ID); MapBase map = app.getMap();/*from w w w . j a va2 s . c o m*/ mLayer = (VectorLayer) map.getLayerById(layerId); if (null != mLayer) { mSharedPreferences = mLayer.getPreferences(); mFields = new HashMap<>(); mFeatureId = extras.getLong(KEY_FEATURE_ID); mIsViewOnly = extras.getBoolean(KEY_VIEW_ONLY, false); mIsGeometryChanged = extras.getBoolean(KEY_GEOMETRY_CHANGED, true); mGeometry = (GeoGeometry) extras.getSerializable(KEY_GEOMETRY); LinearLayout layout = (LinearLayout) findViewById(R.id.controls_list); fillControls(layout, savedState); } else { Toast.makeText(this, R.string.error_layer_not_inited, Toast.LENGTH_SHORT).show(); finish(); } } }