List of usage examples for android.os Bundle putBoolean
public void putBoolean(@Nullable String key, boolean value)
From source file:com.firescar96.nom.GCMIntentService.java
@Override protected void onHandleIntent(Intent intent) { Bundle extras = intent.getExtras();//from w w w . j a va2s . co m GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this); // The getMessageType() intent parameter must be the intent you received // in your BroadcastReceiver. String messageType = gcm.getMessageType(intent); if (!extras.isEmpty()) /* * Filter messages based on message type. Since it is likely that GCM will be * extended in the future with new message types, just ignore any message types you're * not interested in, or that you don't recognize. */ if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equals(messageType)) Log.i(Consts.TAG, "onHandleIntent: message error"); else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED.equals(messageType)) Log.i(Consts.TAG, "onHandleIntent: message deleted"); // If it's a regular GCM message, do some work. else if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) { // Post notification of received message. System.out.println("Received: " + extras.toString()); if (context == null) { System.out.println("null conxtext"); /*Intent needIntent = new Intent(this, MainActivity.class); needIntent.putExtra("purpose", "update"); needIntent.putExtra("mate", (String)extras.get("mate")); needIntent.putExtra("event", (String)extras.get("event")); needIntent.putExtra("chat", (String)extras.get("chat")); needIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(needIntent);*/ System.out.println(getFilesDir().getAbsolutePath()); MainActivity.initAppData(getFilesDir().getAbsolutePath()); } try { if (extras.get("mate") != null) { //context.appData.getJSONArray("mates").put(extras.get("mate")); } if (extras.get("event") != null) { JSONObject eveData = new JSONObject("{\"event\":" + extras.get("event") + "}") .getJSONObject("event"); JSONArray eve = MainActivity.appData.getJSONArray("events"); for (int i = 0; i < eve.length(); i++) { System.out.println(eveData.getString("hash")); System.out.println(eve.getJSONObject(i).getString("hash")); if (eveData.getString("hash").equals(eve.getJSONObject(i).getString("hash"))) return; } eveData.accumulate("member", false); System.out.println(eveData.getLong("date")); System.out.println(Calendar.getInstance().getTimeInMillis()); if (eveData.getLong("date") < Calendar.getInstance().getTimeInMillis()) return; eve.put(eveData); Message msg = new Message(); Bundle data = new Bundle(); data.putString("type", "event." + eveData.getString("privacy")); data.putString("host", eveData.getString("host")); data.putString("date", eveData.getString("date")); msg.setData(data); contextHandler.sendMessage(msg); } if (extras.get("chat") != null) { JSONObject chatData = new JSONObject("{\"chat\":" + extras.get("chat") + "}") .getJSONObject("chat"); JSONArray eve = MainActivity.appData.getJSONArray("events"); for (int i = 0; i < eve.length(); i++) if (chatData.getString("hash").equals(eve.getJSONObject(i).getString("hash"))) { JSONObject msgSon = new JSONObject(); msgSon.accumulate("author", chatData.getString("author")); msgSon.accumulate("message", chatData.getString("message")); eve.getJSONObject(i).getJSONArray("chat").put(msgSon); Message msg = new Message(); Bundle data = new Bundle(); data.putString("type", "chat"); data.putString("author", chatData.getString("author")); data.putString("message", chatData.getString("message")); data.putBoolean("member", eve.getJSONObject(i).getBoolean("member")); data.putString("hash", chatData.getString("hash")); msg.setData(data); contextHandler.sendMessage(msg); return; } } MainActivity.closeAppData(getFilesDir().getAbsolutePath()); } catch (JSONException e1) { e1.printStackTrace(); } } // Release the wake lock provided by the WakefulBroadcastReceiver. MainBroadcastReceiver.completeWakefulIntent(intent); }
From source file:com.android.calendar.AllInOneActivity.java
@Override public void onSaveInstanceState(Bundle outState) { mOnSaveInstanceStateCalled = true;// w w w . j a va 2 s.c om super.onSaveInstanceState(outState); outState.putLong(BUNDLE_KEY_RESTORE_TIME, mController.getTime()); outState.putInt(BUNDLE_KEY_RESTORE_VIEW, mCurrentView); if (mCurrentView == ViewType.EDIT) { outState.putLong(BUNDLE_KEY_EVENT_ID, mController.getEventId()); } else if (mCurrentView == ViewType.AGENDA) { FragmentManager fm = getFragmentManager(); Fragment f = fm.findFragmentById(R.id.main_pane); if (f instanceof AgendaFragment) { outState.putLong(BUNDLE_KEY_EVENT_ID, ((AgendaFragment) f).getLastShowEventId()); } } outState.putBoolean(BUNDLE_KEY_CHECK_ACCOUNTS, mCheckForAccounts); }
From source file:com.aimfire.gallery.GalleryActivity.java
/** * Override Activity lifecycle method./* w ww .java 2s .c o m*/ */ @Override protected void onSaveInstanceState(Bundle outState) { outState.putInt(KEY_PAGER_POSITION, mViewPager.getCurrentItem()); outState.putBoolean(KEY_PAGER_MY_MEDIA, mIsMyMedia); super.onSaveInstanceState(outState); }
From source file:com.dwdesign.tweetings.activity.ComposeActivity.java
@Override public void onSaveInstanceState(final Bundle outState) { mText = parseString(mEditText.getText()); outState.putLongArray(INTENT_KEY_IDS, mAccountIds); outState.putString(INTENT_KEY_TEXT, mText); outState.putLong(INTENT_KEY_IN_REPLY_TO_ID, mInReplyToStatusId); outState.putString(INTENT_KEY_IN_REPLY_TO_NAME, mInReplyToName); outState.putString(INTENT_KEY_IN_REPLY_TO_SCREEN_NAME, mInReplyToScreenName); outState.putBoolean(INTENT_KEY_IS_QUOTE, mIsQuote); outState.putBoolean(INTENT_KEY_IS_IMAGE_ATTACHED, mIsImageAttached); outState.putBoolean(INTENT_KEY_IS_PHOTO_ATTACHED, mIsPhotoAttached); outState.putParcelable(INTENT_KEY_IMAGE_URI, mImageUri); outState.putBoolean(INTENT_KEY_CONTENT_MODIFIED, mContentModified); outState.putBoolean(INTENT_KEY_IS_POSSIBLY_SENSITIVE, mIsPossiblySensitive); super.onSaveInstanceState(outState); }
From source file:cn.suishen.email.activity.MessageViewFragmentBase.java
@Override public void onSaveInstanceState(Bundle outState) { if (Logging.DEBUG_LIFECYCLE && Email.DEBUG) { Log.d(Logging.LOG_TAG, this + " onSaveInstanceState"); }//ww w . j a v a2s . c o m super.onSaveInstanceState(outState); outState.putInt(BUNDLE_KEY_CURRENT_TAB, mCurrentTab); outState.putBoolean(BUNDLE_KEY_PICTURE_LOADED, (mTabFlags & TAB_FLAGS_PICTURE_LOADED) != 0); }
From source file:com.oakesville.mythling.MediaActivity.java
protected void showItemInDetailPane(int position, boolean grabFocus) { ItemDetailFragment detailFragment = new ItemDetailFragment(); Bundle arguments = new Bundle(); arguments.putInt(SEL_ITEM_INDEX, position); arguments.putBoolean(GRAB_FOCUS, grabFocus); detailFragment.setArguments(arguments); // FIXME: Issue #69 getFragmentManager().beginTransaction().replace(R.id.detail_container, detailFragment, DETAIL_FRAGMENT) .commit();/*from w w w . j av a2s.c o m*/ }
From source file:com.oakesville.mythling.MediaActivity.java
protected void showSubListPane(String path, int selIdx, boolean grabFocus) { ItemListFragment listFragment = new ItemListFragment(); Bundle arguments = new Bundle(); arguments.putString(PATH, path);/*from w w w . ja v a 2 s . c om*/ arguments.putInt(SEL_ITEM_INDEX, selIdx); arguments.putBoolean(GRAB_FOCUS, grabFocus); listFragment.setArguments(arguments); getFragmentManager().beginTransaction().replace(R.id.detail_container, listFragment, LIST_FRAGMENT) .commit(); }
From source file:de.sourcestream.movieDB.MainActivity.java
/** * Fired when activity is recreated.//from w w w . j a v a2s.c o m * * @param outState Bundle in which to place your saved state. */ @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt("oldPos", oldPos); outState.putInt("currentMovViewPagerPos", currentMovViewPagerPos); outState.putInt("currentTVViewPagerPos", currentTVViewPagerPos); outState.putBoolean("restoreMovieDetailsAdapterState", restoreMovieDetailsAdapterState); outState.putBoolean("restoreMovieDetailsState", restoreMovieDetailsState); outState.putParcelableArrayList("movieDetailsBundle", movieDetailsBundle); outState.putParcelableArrayList("castDetailsBundle", castDetailsBundle); outState.putParcelableArrayList("tvDetailsBundle", tvDetailsBundle); outState.putInt("currOrientation", currOrientation); outState.putInt("lastVisitedSimMovie", lastVisitedSimMovie); outState.putInt("lastVisitedSimTV", lastVisitedSimTV); outState.putInt("lastVisitedMovieInCredits", lastVisitedMovieInCredits); outState.putBoolean("saveInMovieDetailsSimFragment", saveInMovieDetailsSimFragment); }
From source file:com.vegnab.vegnab.MainVNActivity.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); // save the current subplot arguments in case we need to re-create the activity outState.putLong(ARG_SUBPLOT_TYPE_ID, mSubplotTypeId); outState.putLong(ARG_VISIT_ID, mVisitId); outState.putBoolean(ARG_CONNECTION_REQUESTED, mConnectionRequested); outState.putSerializable(ARG_PH_EXISTING_SET, mExistingPhCodes); outState.putLong(ARG_PURCH_REC_ID, mNewPurcRecId); }
From source file:com.owncloud.android.authentication.AuthenticatorActivity.java
/** * Saves relevant state before {@link #onPause()} * /*w w w. j av a 2 s . c o m*/ * Do NOT save {@link #mNewCapturedUriFromOAuth2Redirection}; it keeps a * temporal flag, intended to defer the processing of the redirection caught * in {@link #onNewIntent(Intent)} until {@link #onResume()} * * See {@link #loadSavedInstanceState(Bundle)} */ @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); // / connection state and info outState.putInt(KEY_AUTH_MESSAGE_VISIBILITY, mAuthMessage.getVisibility()); outState.putString(KEY_AUTH_MESSAGE_TEXT, mAuthMessage.getText().toString()); outState.putInt(KEY_SERVER_STATUS_TEXT, mServerStatusText); outState.putInt(KEY_SERVER_STATUS_ICON, mServerStatusIcon); outState.putBoolean(KEY_SERVER_VALID, mServerIsValid); outState.putBoolean(KEY_SERVER_CHECKED, mServerIsChecked); outState.putBoolean(KEY_SERVER_CHECK_IN_PROGRESS, (!mServerIsValid && mOcServerChkOperation != null)); outState.putBoolean(KEY_IS_SSL_CONN, mIsSslConn); outState.putBoolean(KEY_PASSWORD_VISIBLE, isPasswordVisible()); outState.putInt(KEY_AUTH_STATUS_ICON, mAuthStatusIcon); outState.putInt(KEY_AUTH_STATUS_TEXT, mAuthStatusText); // / server data if (mDiscoveredVersion != null) { outState.putString(KEY_OC_VERSION, mDiscoveredVersion.toString()); } outState.putString(KEY_HOST_URL_TEXT, mHostBaseUrl); // / account data, if updating if (mAccount != null) { outState.putParcelable(KEY_ACCOUNT, mAccount); } outState.putString(AccountAuthenticator.KEY_AUTH_TOKEN_TYPE, mAuthTokenType); // refresh button enabled outState.putBoolean(KEY_REFRESH_BUTTON_ENABLED, (mRefreshButton.getVisibility() == View.VISIBLE)); }