List of usage examples for android.os Bundle putParcelable
public void putParcelable(@Nullable String key, @Nullable Parcelable value)
From source file:com.mindmeapp.extensions.ExtensionData.java
/** * Serializes the contents of this object to a {@link Bundle}. *///from w w w.jav a2 s. c om public Bundle toBundle() { Bundle data = new Bundle(); data.putBoolean(KEY_VISIBLE, mVisible); data.putInt(KEY_ICON, mIcon); data.putString(KEY_ICON_URI, (mIconUri == null ? null : mIconUri.toString())); data.putString(KEY_STATUS_TO_DISPLAY, mStatusToDisplay); data.putString(KEY_STATUS_TO_SPEAK, mStatusToSpeak); data.putParcelable(KEY_VIEWS_TO_DISPLAY, mViewsToDisplay); data.putString(KEY_CONTENT_DESCRIPTION, mContentDescription); data.putSerializable(KEY_LANGUAGE_TO_SPEAK, mLanguageToSpeak); data.putInt(KEY_BACKGROUND, mBackground); data.putString(KEY_BACKGROUND_URI, (mBackgroundUri == null ? null : mBackgroundUri.toString())); return data; }
From source file:com.andybotting.tramhunter.activity.StopDetailsActivity.java
/** * On create of this class/*from w ww . ja v a 2 s . c o m*/ */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.stop_details); // Home title button findViewById(R.id.title_btn_home).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { UIUtils.goHome(StopDetailsActivity.this); } }); // Refresh title button findViewById(R.id.title_btn_refresh).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { mShowDialog = true; new GetNextTramTimes().execute(); } }); // Map title button findViewById(R.id.title_btn_map).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Bundle bundle = new Bundle(); StopsList mStopList = new StopsList(); mStopList.add(mStop); bundle.putParcelable("stopslist", mStopList); Intent intent = new Intent(StopDetailsActivity.this, StopMapActivity.class); intent.putExtras(bundle); startActivityForResult(intent, 1); } }); // Set up our list mListAdapter = new NextTramsListAdapter(); mListView = getListView(); mListView.setVisibility(View.GONE); // Preferences mPreferenceHelper = new PreferenceHelper(); // Get bundle data int routeId = -1; Bundle extras = getIntent().getExtras(); if (extras != null) { mTramTrackerId = extras.getInt("tramTrackerId"); routeId = extras.getInt("routeId", -1); } // Get our favourite stops list mFavouriteList = new FavouriteList(); // Create out DB instance mDB = new TramHunterDB(); mStop = mDB.getStop(mTramTrackerId); if (routeId > -1) mRoute = mDB.getRoute(routeId); // Set the title String title = mStop.getStopName(); ((TextView) findViewById(R.id.title_text)).setText(title); // Display stop data displayStop(mStop); // Star button mStarButton = (CompoundButton) findViewById(R.id.stopStar); mStarButton.setChecked(mFavouriteList.isFavourite(new Favourite(mStop, mRoute))); mStarButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { mFavouriteList.setFavourite(new Favourite(mStop, mRoute), mStarButton.isChecked()); } }); // Get our TramTracker service, either SOAP (def) or JSON // if (mPreferenceHelper.isJSONAPIEnabled()) // ttService = new TramTrackerServiceJSON(); // else ttService = new TramTrackerServiceSOAP(); // Our thread for updating the stops every 60 secs mRefreshThread = new Thread(new CountDown()); mRefreshThread.setDaemon(true); mRefreshThread.start(); }
From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_trainer.AbstractSignTrainerFragment.java
@Override public void onSaveInstanceState(Bundle outState) { Log.d(AbstractSignTrainerFragment.TAG, "onSaveInstance " + hashCode()); super.onSaveInstanceState(outState); if (null != this.answerViews) { Validate.notEmpty(this.answerViews, "AnswerViews should always contain at least one view!"); final boolean answerVisible = View.VISIBLE == this.answerViews[0].getVisibility(); outState.putBoolean(KEY_ANSWER_VISIBLE, answerVisible); } else {/*from ww w .ja v a2 s. c o m*/ outState.putBoolean(KEY_ANSWER_VISIBLE, Boolean.FALSE); } if (null != this.currentSign) { outState.putParcelable(KEY_CURRENT_SIGN, this.currentSign); } }
From source file:no.nordicsemi.android.nrftoolbox.dfu.DfuActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(DATA_FILE_PATH, mFilePath); outState.putParcelable(DATA_FILE_STREAM, mFileStreamUri); outState.putBoolean(DATA_STATUS, mStatusOk); }
From source file:com.dwdesign.tweetings.fragment.UserListDetailsFragment.java
@Override public boolean onMenuItemClick(final MenuItem item) { switch (item.getItemId()) { case MENU_FOLLOW: { if (mAccountId != mUserId) { if (mUserList.isFollowing()) { mService.destroyUserListSubscription(mAccountId, mUserList.getId()); } else { mService.createUserListSubscription(mAccountId, mUserList.getId()); }/*from ww w .j a va 2s . c om*/ } break; } case MENU_ADD: { final Bundle args = new Bundle(); args.putLong(INTENT_KEY_ACCOUNT_ID, mAccountId); args.putString(INTENT_KEY_TEXT, ""); args.putInt(INTENT_KEY_LIST_ID, mUserList.getId()); mAddMemberDialogFragment.setArguments(args); mAddMemberDialogFragment.show(getFragmentManager(), "add_member"); break; } case MENU_ADD_TAB: { CustomTabsAdapter mAdapter; mAdapter = new CustomTabsAdapter(getActivity()); ContentResolver mResolver; mResolver = getContentResolver(); final String tabName = mListName; final String tabType = AUTHORITY_LIST_TIMELINE; final String tabIcon = "list"; final long account_id = mAccountId; final String tabScreenName = mUserScreenName; final String tabListName = mListName; final String tabArguments = "{\"account_id\":" + account_id + ",\"screen_name\":\"" + tabScreenName + "\",\"list_name\":" + JSONObject.quote(tabListName) + "}"; final ContentValues values = new ContentValues(); values.put(Tabs.ARGUMENTS, tabArguments); values.put(Tabs.NAME, tabName); values.put(Tabs.POSITION, mAdapter.getCount()); values.put(Tabs.TYPE, tabType); values.put(Tabs.ICON, tabIcon); mResolver.insert(Tabs.CONTENT_URI, values); Toast.makeText(this.getActivity(), R.string.list_tab_added, Toast.LENGTH_SHORT).show(); break; } case MENU_DELETE: { if (mUserId != mAccountId) return false; mService.destroyUserList(mAccountId, mUserListId); break; } case MENU_EXTENSIONS: { final Intent intent = new Intent(INTENT_ACTION_EXTENSION_OPEN_USER_LIST); final Bundle extras = new Bundle(); extras.putParcelable(INTENT_KEY_USER_LIST, new ParcelableUserList(mUserList, mAccountId)); intent.putExtras(extras); startActivity(Intent.createChooser(intent, getString(R.string.open_with_extensions))); break; } } return true; }
From source file:com.nextgis.firereporter.GetFiresService.java
protected void SendScanexItem(ScanexSubscriptionItem item) { if (mScanexReceiver == null) return;/* w w w. j a va 2 s.com*/ Bundle b = new Bundle(); b.putLong(SUBSCRIPTION_ID, item.GetId()); b.putInt(TYPE, SCANEX_SUBSCRIPTION); b.putParcelable(ITEM, item); mScanexReceiver.send(SERVICE_SCANEXDATA, b); }
From source file:br.liveo.searchliveo.SearchCardLiveo.java
@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable(INSTANCE_STATE, super.onSaveInstanceState()); bundle.putBoolean(STATE_TO_SAVE, this.isActive()); if (!mEdtSearch.getText().toString().trim().equals("")) { bundle.putString(SEARCH_TEXT, mEdtSearch.getText().toString()); }/*from w w w . j a va2 s . c o m*/ return bundle; }
From source file:com.cerema.cloud2.ui.fragment.OCFileListFragment.java
/** * Saves the current listed folder.//from ww w .j a v a 2 s. c om */ @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable(KEY_FILE, mFile); }
From source file:net.exclaimindustries.geohashdroid.wiki.WikiPictureEditor.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(STORED_FILE, mCurrentFile); outState.putParcelable(STORED_LOCATION, mPictureLocation); }
From source file:android.support.car.app.CarFragmentActivity.java
/** * Save all appropriate fragment state./*from w w w .jav a 2 s .c om*/ */ @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); Parcelable p = mFragments.saveAllState(); if (p != null) { outState.putParcelable(FRAGMENTS_TAG, p); } }