List of usage examples for android.os Bundle getSerializable
@Override
@Nullable
public Serializable getSerializable(@Nullable String key)
From source file:de.damdi.fitness.activity.start_training.FExListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fex_list); if (savedInstanceState != null) { mWorkout = (Workout) savedInstanceState.getSerializable(ARG_WORKOUT); } else {//from w w w.j a v a 2 s .com // retrieve argument and pass it to fragment mWorkout = (Workout) getIntent().getExtras().getSerializable(ARG_WORKOUT); } FExListFragment fragment = (FExListFragment) getSupportFragmentManager() .findFragmentById(R.id.exercise_list); fragment.setWorkout(mWorkout); // Show the Up button in the action bar. getSupportActionBar().setDisplayHomeAsUpEnabled(true); if (findViewById(R.id.exercise_detail_container) != null) { // The detail container view will be present only in the // large-screen layouts (res/values-large and // res/values-sw600dp). If this view is present, then the // activity should be in two-pane mode. mTwoPane = true; // In two-pane mode, list items should be given the // 'activated' state when touched. ((FExListFragment) getSupportFragmentManager().findFragmentById(R.id.exercise_list)) .setActivateOnItemClick(true); } }
From source file:com.teleca.jamendo.activity.SearchActivity.java
@SuppressWarnings("unchecked") @Override/*from w w w . ja v a 2 s. com*/ protected void onRestoreInstanceState(Bundle savedInstanceState) { mSearchMode = (SearchMode) savedInstanceState.getSerializable("mode"); if (mSearchMode != null) { if (mSearchMode.equals(SearchMode.Artist) || mSearchMode.equals(SearchMode.Tag) || mSearchMode.equals(SearchMode.UserStarredAlbums)) { AlbumAdapter adapter = new AlbumAdapter(this); adapter.setList((ArrayList<Album>) savedInstanceState.get("values")); mSearchListView.setAdapter(adapter); mSearchListView.setOnItemClickListener(mAlbumClickListener); } if (mSearchMode.equals(SearchMode.UserPlaylist)) { PlaylistRemoteAdapter adapter = new PlaylistRemoteAdapter(this); adapter.setList((ArrayList<PlaylistRemote>) savedInstanceState.get("values")); mSearchListView.setAdapter(adapter); mSearchListView.setOnItemClickListener(mPlaylistClickListener); } mViewFlipper.setDisplayedChild(savedInstanceState.getInt("flipper_page")); } super.onRestoreInstanceState(savedInstanceState); }
From source file:com.seregil13.literarytracker.lightnovel.LightNovelEditFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle arguments = getArguments(); this.mCreateOrEdit = (Mode) arguments.getSerializable(CREATE_OR_EDIT_KEY); if (this.mCreateOrEdit == null) { this.mCreateOrEdit = Mode.CREATE; }/*ww w.ja va 2s.c om*/ switch (this.mCreateOrEdit) { case CREATE: this.mTitle = ""; this.mAuthor = ""; this.mDescription = ""; this.mCompleted = "false"; this.mTranslatorSite = ""; this.mGenres = new ArrayList<>(); break; case EDIT: this.mId = arguments.getInt(JsonKeys.ID.toString()); this.mTitle = arguments.getString(JsonKeys.TITLE.toString()); this.mAuthor = arguments.getString(JsonKeys.AUTHOR.toString()); this.mDescription = arguments.getString(JsonKeys.DESCRIPTION.toString()); this.mCompleted = arguments.getString(JsonKeys.COMPLETED.toString()); this.mTranslatorSite = arguments.getString(JsonKeys.TRANSLATOR_SITE.toString()); this.mGenres = arguments.getStringArrayList(JsonKeys.GENRES.toString()); break; } }
From source file:fi.mikuz.boarder.gui.internet.Login.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setVolumeControlStream(AudioManager.STREAM_MUSIC); mDbHelper = new LoginDbAdapter(Login.this); mDbHelper.open();//from w w w. j a v a2s .c o m Bundle extras = getIntent().getExtras(); if (extras.getSerializable(InternetMenu.LOGIN_KEY) != null) { mWaitDialog = new TimeoutProgressDialog(Login.this, "Logging out", TAG, true); @SuppressWarnings("unchecked") HashMap<String, String> lastSession = (HashMap<String, String>) extras .getSerializable(InternetMenu.LOGIN_KEY); mReturnSession = lastSession; mDbHelper.deleteLogin(InternetMenu.USER_ID_KEY); mDbHelper.deleteLogin(InternetMenu.SESSION_TOKEN_KEY); HashMap<String, String> sendList = new HashMap<String, String>(); sendList.put(InternetMenu.USER_ID_KEY, lastSession.get(InternetMenu.USER_ID_KEY)); sendList.put(InternetMenu.SESSION_TOKEN_KEY, lastSession.get(InternetMenu.SESSION_TOKEN_KEY)); new ConnectionManager(Login.this, InternetMenu.mLogoutURL, sendList); } else { showLoggedOutView(); } }
From source file:edu.asu.cse535.assignment3.MainActivity.java
public void classifyActivity(View v) { final Handler testHandler = new Handler() { @Override//from w ww. j av a2s. com public void handleMessage(Message msg) { Log.w(this.getClass().getSimpleName(), "Message received and stopping service"); Bundle b = msg.getData(); ActivityData activityData = (ActivityData) b.getSerializable("ActivityData"); notifyCompletion(); stopService(testIntent); unbindService(testServiceConnection); AndroidLibsvmClassifier androidLibsvmClassifier = new AndroidLibsvmClassifier(); String activity = androidLibsvmClassifier.classify(activityData); toastActivity(activity); } }; testIntent = new Intent(MainActivity.this.getBaseContext(), AccIntentService.class); testIntent.putExtra("activity", Constants.CLASSIFY); testServiceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { AccIntentService testAaccIntentService = ((AccIntentService.LocalBinder) service).getInstance(); testAaccIntentService.setHandler(testHandler); Log.w(this.getClass().getSimpleName(), "Test activity is connected to service"); } @Override public void onServiceDisconnected(ComponentName name) { } }; startService(testIntent); bindService(testIntent, testServiceConnection, Context.BIND_AUTO_CREATE); }
From source file:edu.mecc.race2ged.activities.HomeActivity.java
/** * This method is called after {@link #onStart} when the activity is * being re-initialized from a previously saved state, given here in * <var>savedInstanceState</var>. Most implementations will simply use {@link #onCreate} * to restore their state, but it is sometimes convenient to do it here * after all of the initialization has been done or to allow subclasses to * decide whether to use your default implementation. The default * implementation of this method performs a restore of any view state that * had previously been frozen by {@link #onSaveInstanceState}. * <p/>//from w w w. ja v a 2 s . c o m * <p>This method is called between {@link #onStart} and * {@link #onPostCreate}. * * @param savedInstanceState the data most recently supplied in {@link #onSaveInstanceState}. * @see #onCreate * @see #onPostCreate * @see #onResume * @see #onSaveInstanceState */ @Override protected void onRestoreInstanceState(@NotNull Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); if (mRegion == null) { mRegion = (Region) savedInstanceState.getSerializable(ARG_REGION); } }
From source file:ca.liquidlabs.android.speedtestvisualizer.fragments.GraphViewMasterFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Get the arguments and save them. Bundle bundleArgs = getArguments(); mCsvHeader = bundleArgs.getString(BUNDLE_ARG_HEADER); mCsvData = bundleArgs.getString(BUNDLE_ARG_DATA); mGraphType = (GraphType) bundleArgs.getSerializable(BUNDLE_ARG_GRAPH_TYPE); mGraphDateLabelFormatter = new GraphLabelDate(); new SpeedTestRecordProcessorTask(this).execute(mCsvHeader, mCsvData, mGraphType.name()); Tracer.debug(LOG_TAG, "onActivityCreated()"); }
From source file:com.ev.contactsmultipicker.ContactListFragment.java
@SuppressWarnings("unchecked") @Override//w ww .j ava 2 s . co m public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (savedInstanceState != null) { results = (Hashtable<String, ContactResult>) savedInstanceState.getSerializable(SAVE_STATE_KEY); } View rootView = inflater.inflate(R.layout.contact_list_fragment, container); mContactListView = (ListView) rootView.findViewById(R.id.contactListView); mContactListView.setAdapter(mCursorAdapter); mContactListView.setOnItemClickListener(this); return rootView; }
From source file:com.github.pedrovgs.sample.activity.PlacesSampleActivity.java
/** * Get the DraggablePanelState from the saved bundle, modify the DraggablePanel visibility to * GONE/*from ww w. j a va 2 s .c om*/ * and apply the * DraggablePanelState to recover the last graphic state. */ private void recoverDraggablePanelState(Bundle savedInstanceState) { final DraggableState draggableState = (DraggableState) savedInstanceState .getSerializable(DRAGGABLE_PANEL_STATE); if (draggableState == null) { draggablePanel.setVisibility(View.GONE); return; } updateDraggablePanelStateDelayed(draggableState); }
From source file:org.mifos.androidclient.main.AccountTransactionHistoryActivity.java
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.transaction_history); if (bundle != null && bundle.containsKey(TransactionHistoryEntry.BUNDLE_KEY)) { mTransactionHistoryEntries = (List<TransactionHistoryEntry>) bundle .getSerializable(TransactionHistoryEntry.BUNDLE_KEY); }/*from w w w . j av a2 s . c o m*/ mTransactionHistoryList = (ListView) findViewById(R.id.transactionHistory_list); mAccountNumber = getIntent().getStringExtra(AbstractAccountDetails.ACCOUNT_NUMBER_BUNDLE_KEY); mAccountService = new AccountService(this); }