List of usage examples for android.os Bundle putInt
public void putInt(@Nullable String key, int value)
From source file:com.chatwing.whitelabel.activities.CommunicationActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { outState.putString("WORKAROUND_FOR_BUG_19917_KEY", "WORKAROUND_FOR_BUG_19917_VALUE"); super.onSaveInstanceState(outState); LogUtils.v("onSaveInstanceState save mode"); mChatboxModeManager.onSaveInstanceState(outState); mConversationModeManager.onSaveInstanceState(outState); if (isInChatBoxMode()) { outState.putInt(EXTRA_CURRENT_MODE, MODE_CHAT_BOX); } else if (isInConversationMode()) { outState.putInt(EXTRA_CURRENT_MODE, MODE_CONVERSATION); }/* ww w .ja va 2 s.c om*/ }
From source file:de.sourcestream.movieDB.MainActivity.java
/** * Fired when activity is recreated./*from w w w . j a v a 2s . co 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:in.shick.diode.threads.ThreadsListActivity.java
@Override protected void onSaveInstanceState(Bundle state) { super.onSaveInstanceState(state); state.putString(Constants.SUBREDDIT_KEY, mSubreddit); state.putString(Constants.QUERY_KEY, mSearchQuery); state.putString(Constants.ThreadsSort.SORT_BY_KEY, mSortByUrl); state.putString(Constants.JUMP_TO_THREAD_ID_KEY, mJumpToThreadId); state.putString(Constants.AFTER_KEY, mAfter); state.putString(Constants.BEFORE_KEY, mBefore); state.putInt(Constants.THREAD_COUNT_KEY, mCount); state.putString(Constants.LAST_AFTER_KEY, mLastAfter); state.putString(Constants.LAST_BEFORE_KEY, mLastBefore); state.putInt(Constants.THREAD_LAST_COUNT_KEY, mLastCount); state.putParcelable(Constants.VOTE_TARGET_THING_INFO_KEY, mVoteTargetThing); }
From source file:de.sourcestream.movieDB.controller.MovieDetails.java
/** * Called to ask the fragment to save its current dynamic state, * so it can later be reconstructed in a new instance of its process is restarted. * * @param outState Bundle in which to place your saved state. */// w ww . j a va 2s.co m @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); // Used to avoid bug where we add item in the back stack // and if we change orientation twice the item from the back stack has null values if (save != null && save.getInt("timeOut") == 1) save = null; if (save != null) { if (movieDetailsCast != null) save.putInt("lastVisitedPerson", movieDetailsCast.getLastVisitedPerson()); outState.putBundle("save", save); if (addToBackStack) { activity.addMovieDetailsBundle(save); addToBackStack = false; } } else { Bundle send = new Bundle(); send.putInt("currentId", currentId); if (request != null && request.getStatus() == AsyncTask.Status.RUNNING) { timeOut = 1; request.cancel(true); } send.putInt("timeOut", timeOut); send.putString("title", title); if (timeOut == 0) { // HomePage send.putInt("homeIconCheck", homeIconCheck); if (homeIconCheck == 0) send.putString("homepage", homeIconUrl); // Gallery icon send.putInt("galleryIconCheck", galleryIconCheck); if (galleryIconCheck == 0) send.putStringArrayList("galleryList", galleryList); // Trailer icon send.putInt("trailerIconCheck", trailerIconCheck); if (trailerIconCheck == 0) send.putStringArrayList("trailerList", trailerList); // More icon send.putInt("moreIconCheck", moreIconCheck); // Movie details info begins here if (movieDetailsInfo != null) { // Backdrop path send.putInt("backDropCheck", movieDetailsInfo.getBackDropCheck()); if (movieDetailsInfo.getBackDropCheck() == 0 && movieDetailsInfo.getBackDropPath().getTag() != null) send.putString("backDropUrl", movieDetailsInfo.getBackDropPath().getTag().toString()); // Poster path url if (movieDetailsInfo.getPosterPath().getTag() != null) send.putString("posterPathURL", movieDetailsInfo.getPosterPath().getTag().toString()); // Rating send.putFloat("rating", movieDetailsInfo.getRatingBar().getRating()); send.putString("voteCount", movieDetailsInfo.getVoteCount().getText().toString()); // Title send.putString("titleText", movieDetailsInfo.getTitleText().getText().toString()); // Release date send.putString("releaseDate", movieDetailsInfo.getReleaseDate().getText().toString()); // Status send.putString("status", movieDetailsInfo.getStatusText().getText().toString()); // Tag line send.putString("tagline", movieDetailsInfo.getTagline().getText().toString()); // RunTime send.putString("runTime", movieDetailsInfo.getRuntime().getText().toString()); // Genres send.putString("genres", movieDetailsInfo.getGenres().getText().toString()); // Production countries send.putString("productionCountries", movieDetailsInfo.getCountries().getText().toString()); // Production companies send.putString("productionCompanies", movieDetailsInfo.getCompanies().getText().toString()); // Similar list if (movieDetailsInfo.getSimilarList() != null && movieDetailsInfo.getSimilarList().size() > 0) send.putParcelableArrayList("similarList", movieDetailsInfo.getSimilarList()); } // Movie details info ends here // Movie details cast starts here if (movieDetailsCast != null) { send.putParcelableArrayList("castList", castList); send.putInt("lastVisitedPerson", movieDetailsCast.getLastVisitedPerson()); } // Movie details cast ends here // Overview if (movieDetailsOverview != null) send.putString("overview", movieDetailsOverview.getOverview().getText().toString()); } outState.putBundle("save", send); save = send; if (addToBackStack) { activity.addMovieDetailsBundle(send); addToBackStack = false; } } }
From source file:com.dwdesign.tweetings.fragment.UserProfileFragment.java
@Override public boolean onLongClick(final View view) { if (mUser == null) return false; final boolean is_my_activated_account = isMyActivatedAccount(getActivity(), mUser.getId()); if (!is_my_activated_account) return false; switch (view.getId()) { case R.id.profile_image_container: { mPopupMenu = PopupMenu.getInstance(getActivity(), view); mPopupMenu.inflate(R.menu.action_profile_image); mPopupMenu.setOnMenuItemClickListener(this); mPopupMenu.show();//from w w w. j a v a 2 s . c o m return true; } case R.id.name_container: { final Bundle args = new Bundle(); args.putLong(INTENT_KEY_ACCOUNT_ID, mUser.getId()); args.putString(INTENT_KEY_TEXT, mUser.getName()); args.putString(INTENT_KEY_TITLE, getString(R.string.name)); args.putInt(INTENT_KEY_TYPE, TYPE_NAME); mDialogFragment.setArguments(args); mDialogFragment.show(getFragmentManager(), "edit_name"); return true; } case R.id.description_container: { final Bundle args = new Bundle(); args.putLong(INTENT_KEY_ACCOUNT_ID, mUser.getId()); args.putString(INTENT_KEY_TEXT, mUser.getDescription()); args.putString(INTENT_KEY_TITLE, getString(R.string.description)); args.putInt(INTENT_KEY_TYPE, TYPE_DESCRIPTION); mDialogFragment.setArguments(args); mDialogFragment.show(getFragmentManager(), "edit_description"); return true; } case R.id.location_container: { final Bundle args = new Bundle(); args.putLong(INTENT_KEY_ACCOUNT_ID, mUser.getId()); args.putString(INTENT_KEY_TEXT, mUser.getLocation()); args.putString(INTENT_KEY_TITLE, getString(R.string.location)); args.putInt(INTENT_KEY_TYPE, TYPE_LOCATION); mDialogFragment.setArguments(args); mDialogFragment.show(getFragmentManager(), "edit_location"); return true; } case R.id.url_container: { final URL url = mUser.getURL(); final Bundle args = new Bundle(); args.putLong(INTENT_KEY_ACCOUNT_ID, mUser.getId()); args.putString(INTENT_KEY_TEXT, url != null ? url.toString() : null); args.putString(INTENT_KEY_TITLE, getString(R.string.url)); args.putInt(INTENT_KEY_TYPE, TYPE_URL); mDialogFragment.setArguments(args); mDialogFragment.show(getFragmentManager(), "edit_url"); return true; } } return false; }
From source file:org.openhab.habdroid.ui.OpenHABMainActivity.java
@Override public void onSaveInstanceState(Bundle savedInstanceState) { Log.d(TAG, "onSaveInstanceState"); // Save opened framents into state retaining fragment (I love Google! :-) Log.d(TAG, String.format("Saving %d fragments", pagerAdapter.getFragmentList().size())); Log.d(TAG, String.format("Saving current page = %d", pager.getCurrentItem())); stateFragment.setFragmentList(pagerAdapter.getFragmentList()); stateFragment.setCurrentPage(pager.getCurrentItem()); // Save UI state changes to the savedInstanceState. // This bundle will be passed to onCreate if the process is // killed and restarted. savedInstanceState.putString("openHABBaseUrl", openHABBaseUrl); savedInstanceState.putString("sitemapRootUrl", sitemapRootUrl); savedInstanceState.putInt("currentFragment", pager.getCurrentItem()); savedInstanceState.putParcelable("startedWithNetworkConnectivityInfo", mStartedWithNetworkConnectivityInfo); savedInstanceState.putInt("openHABVersion", mOpenHABVersion); savedInstanceState.putParcelableArrayList("sitemapList", mSitemapList); super.onSaveInstanceState(savedInstanceState); }
From source file:com.facebook.SharedPreferencesTokenCache.java
private void deserializeKey(String key, Bundle bundle) throws JSONException { String jsonString = cache.getString(key, "{}"); JSONObject json = new JSONObject(jsonString); String valueType = json.getString(JSON_VALUE_TYPE); if (valueType.equals(TYPE_BOOLEAN)) { bundle.putBoolean(key, json.getBoolean(JSON_VALUE)); } else if (valueType.equals(TYPE_BOOLEAN_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); boolean[] array = new boolean[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = jsonArray.getBoolean(i); }//www . j a va2s. c o m bundle.putBooleanArray(key, array); } else if (valueType.equals(TYPE_BYTE)) { bundle.putByte(key, (byte) json.getInt(JSON_VALUE)); } else if (valueType.equals(TYPE_BYTE_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); byte[] array = new byte[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = (byte) jsonArray.getInt(i); } bundle.putByteArray(key, array); } else if (valueType.equals(TYPE_SHORT)) { bundle.putShort(key, (short) json.getInt(JSON_VALUE)); } else if (valueType.equals(TYPE_SHORT_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); short[] array = new short[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = (short) jsonArray.getInt(i); } bundle.putShortArray(key, array); } else if (valueType.equals(TYPE_INTEGER)) { bundle.putInt(key, json.getInt(JSON_VALUE)); } else if (valueType.equals(TYPE_INTEGER_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); int[] array = new int[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = jsonArray.getInt(i); } bundle.putIntArray(key, array); } else if (valueType.equals(TYPE_LONG)) { bundle.putLong(key, json.getLong(JSON_VALUE)); } else if (valueType.equals(TYPE_LONG_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); long[] array = new long[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = jsonArray.getLong(i); } bundle.putLongArray(key, array); } else if (valueType.equals(TYPE_FLOAT)) { bundle.putFloat(key, (float) json.getDouble(JSON_VALUE)); } else if (valueType.equals(TYPE_FLOAT_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); float[] array = new float[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = (float) jsonArray.getDouble(i); } bundle.putFloatArray(key, array); } else if (valueType.equals(TYPE_DOUBLE)) { bundle.putDouble(key, json.getDouble(JSON_VALUE)); } else if (valueType.equals(TYPE_DOUBLE_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); double[] array = new double[jsonArray.length()]; for (int i = 0; i < array.length; i++) { array[i] = jsonArray.getDouble(i); } bundle.putDoubleArray(key, array); } else if (valueType.equals(TYPE_CHAR)) { String charString = json.getString(JSON_VALUE); if (charString != null && charString.length() == 1) { bundle.putChar(key, charString.charAt(0)); } } else if (valueType.equals(TYPE_CHAR_ARRAY)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); char[] array = new char[jsonArray.length()]; for (int i = 0; i < array.length; i++) { String charString = jsonArray.getString(i); if (charString != null && charString.length() == 1) { array[i] = charString.charAt(0); } } bundle.putCharArray(key, array); } else if (valueType.equals(TYPE_STRING)) { bundle.putString(key, json.getString(JSON_VALUE)); } else if (valueType.equals(TYPE_STRING_LIST)) { JSONArray jsonArray = json.getJSONArray(JSON_VALUE); int numStrings = jsonArray.length(); ArrayList<String> stringList = new ArrayList<String>(numStrings); for (int i = 0; i < numStrings; i++) { Object jsonStringValue = jsonArray.get(i); stringList.add(i, jsonStringValue == JSONObject.NULL ? null : (String) jsonStringValue); } bundle.putStringArrayList(key, stringList); } }
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"); }//from w ww.ja v a2 s . c om 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.transistorsoft.cordova.bggeo.CDVBackgroundGeolocation.java
private void addGeofence(CallbackContext callbackContext, JSONObject config) { try {/*from ww w . j ava 2 s . c om*/ String identifier = config.getString("identifier"); final Bundle event = new Bundle(); event.putString("name", BackgroundGeolocationService.ACTION_ADD_GEOFENCE); event.putBoolean("request", true); event.putFloat("radius", (float) config.getLong("radius")); event.putDouble("latitude", config.getDouble("latitude")); event.putDouble("longitude", config.getDouble("longitude")); event.putString("identifier", identifier); if (config.has("notifyOnEntry")) { event.putBoolean("notifyOnEntry", config.getBoolean("notifyOnEntry")); } if (config.has("notifyOnExit")) { event.putBoolean("notifyOnExit", config.getBoolean("notifyOnExit")); } if (config.has("notifyOnDwell")) { event.putBoolean("notifyOnDwell", config.getBoolean("notifyOnDwell")); } if (config.has("loiteringDelay")) { event.putInt("loiteringDelay", config.getInt("loiteringDelay")); } addGeofenceCallbacks.put(identifier, callbackContext); postEvent(event); } catch (JSONException e) { e.printStackTrace(); callbackContext.error(e.getMessage()); } }