List of usage examples for android.os Bundle putInt
public void putInt(@Nullable String key, int value)
From source file:edu.cnu.PowerTutor.ui.PowerViewer.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean("collecting", collecting); outState.putStringArray("componentNames", componentNames); outState.putInt("noUidMask", noUidMask); }
From source file:com.jbsoft.farmtotable.FarmToTableActivity.java
@Override public void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); savedInstanceState.putInt(STATE_NAV, getSupportActionBar().getSelectedNavigationIndex()); }
From source file:com.example.smsquickform.Homescreen.java
/** * Called when the screen rotates. If this isn't handled, data already generated is no longer available *///from w w w. ja v a 2 s . com @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); MyAdapter adapter = (MyAdapter) (mLstDevices.getAdapter()); ArrayList<BluetoothDevice> list = (ArrayList<BluetoothDevice>) adapter.getEntireList(); if (list != null) { outState.putParcelableArrayList(DEVICE_LIST, list); int selectedIndex = adapter.selectedIndex; outState.putInt(DEVICE_LIST_SELECTED, selectedIndex); } }
From source file:de.mangelow.throughput.NotificationService.java
private void removeNotification() { NotificationManager nmanager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); nmanager.cancel(NOTIFICATION_ID);/*from www . j a va 2 s .c o m*/ if (mResultReceiver != null) { Bundle bundle = new Bundle(); bundle.putInt("drawable", R.drawable.ic_stat_zero); bundle.putString("title", ""); bundle.putString("subtitle", ""); mResultReceiver.send(0, bundle); } }
From source file:com.googlecode.CallerLookup.Main.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(PREFS_LOOKUP, mLookup.getSelectedItemPosition()); outState.putString(PREFS_URL, mURL.getText().toString()); outState.putString(PREFS_REGEXP, mRegExp.getText().toString()); outState.putString(STATE_TESTINPUT, mTestInput.getText().toString()); outState.putBoolean(PREFS_NOTIFY, mNotify.isChecked()); }
From source file:com.optimusinfo.elasticpath.cortex.profile.address.AddressActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putSerializable(KEY_GEOGRAPHIES, mGeographies); outState.putSerializable(KEY_REGIONS, mRegions); if (mObjAddress != null) { outState.putSerializable(Constants.PageUrl.INTENT_ADRESS, mObjAddress); }/*from w w w . j a va2 s.co m*/ outState.putInt(KEY_POSITION_COUNTRIES, mSPCountry.getSelectedItemPosition()); outState.putInt(KEY_POSITION_REGIONS, mSPProvince.getSelectedItemPosition()); outState.putString(KEY_ADDRESS_POST, mAddressPostUrl); }
From source file:de.sourcestream.movieDB.controller.SearchList.java
public void onSuggestionClick(int id, String mediaType, String title) { FragmentManager manager = getFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); boolean result; Bundle args;/* www . j av a 2 s. c o m*/ switch (mediaType) { case "movie": activity.setRestoreMovieDetailsAdapterState(true); activity.setRestoreMovieDetailsState(false); if (movieDetails != null && lastVisitedId == id && movieDetails.getTimeOut() == 0) { // Old movie details retrieve info and re-init component else crash movieDetails.onSaveInstanceState(new Bundle()); Bundle bundle = new Bundle(); bundle.putInt("id", id); Bundle save = movieDetails.getSave(); movieDetails = new MovieDetails(); movieDetails.setTimeOut(0); movieDetails.setSave(save); movieDetails.setArguments(bundle); } else movieDetails = new MovieDetails(); args = new Bundle(); args.putInt("id", id); movieDetails.setArguments(args); movieDetails.setTitle(title); transaction.replace(R.id.frame_container, movieDetails); result = true; break; case "person": activity.setRestoreMovieDetailsAdapterState(true); activity.setRestoreMovieDetailsState(false); if (castDetails != null && lastVisitedId == id && castDetails.getTimeOut() == 0) { // Old movie details retrieve info and re-init component else crash castDetails.onSaveInstanceState(new Bundle()); Bundle bundle = new Bundle(); bundle.putInt("id", id); Bundle save = castDetails.getSave(); castDetails = new CastDetails(); castDetails.setTimeOut(0); castDetails.setSave(save); castDetails.setArguments(bundle); } else castDetails = new CastDetails(); args = new Bundle(); args.putInt("id", id); castDetails.setArguments(args); castDetails.setTitle(title); transaction.replace(R.id.frame_container, castDetails); result = true; break; case "tv": activity.setRestoreMovieDetailsAdapterState(true); activity.setRestoreMovieDetailsState(false); if (tvDetails != null && lastVisitedId == id && tvDetails.getTimeOut() == 0) { // Old movie details retrieve info and re-init component else crash tvDetails.onSaveInstanceState(new Bundle()); Bundle bundle = new Bundle(); bundle.putInt("id", id); Bundle save = tvDetails.getSave(); tvDetails = new TVDetails(); tvDetails.setTimeOut(0); tvDetails.setSave(save); tvDetails.setArguments(bundle); } else tvDetails = new TVDetails(); args = new Bundle(); args.putInt("id", id); tvDetails.setArguments(args); tvDetails.setTitle(title); transaction.replace(R.id.frame_container, tvDetails); result = true; break; default: result = false; break; } lastVisitedId = id; if (result) { // add the current transaction to the back stack: transaction.addToBackStack("movieList"); transaction.commit(); // collapse the search View ((MainActivity) getActivity()).collapseSearchView(); } }
From source file:de.sourcestream.movieDB.controller.SearchList.java
/** * Callback method to be invoked when an item in this AdapterView has been clicked. * * @param parent The AdapterView where the click happened. * @param view The view within the AdapterView that was clicked (this will be a view provided by the adapter) * @param position The position of the view in the adapter. * @param id The row id of the item that was clicked. *//*from w ww .ja v a 2s.c o m*/ @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { FragmentManager manager = getFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); boolean result; Bundle args; switch (searchList.get(position).getMediaType()) { case "movie": activity.setRestoreMovieDetailsAdapterState(true); activity.setRestoreMovieDetailsState(false); if (movieDetails != null && lastVisitedId == searchList.get(position).getId() && movieDetails.getTimeOut() == 0) { // Old movie details retrieve info and re-init component else crash movieDetails.onSaveInstanceState(new Bundle()); Bundle bundle = new Bundle(); bundle.putInt("id", searchList.get(position).getId()); Bundle save = movieDetails.getSave(); movieDetails = new MovieDetails(); movieDetails.setTimeOut(0); movieDetails.setSave(save); movieDetails.setArguments(bundle); } else movieDetails = new MovieDetails(); args = new Bundle(); args.putInt("id", searchList.get(position).getId()); movieDetails.setArguments(args); movieDetails.setTitle(searchList.get(position).getTitle()); transaction.replace(R.id.frame_container, movieDetails); result = true; break; case "person": activity.setRestoreMovieDetailsAdapterState(true); activity.setRestoreMovieDetailsState(false); if (castDetails != null && lastVisitedId == searchList.get(position).getId() && castDetails.getTimeOut() == 0) { // Old movie details retrieve info and re-init component else crash castDetails.onSaveInstanceState(new Bundle()); Bundle bundle = new Bundle(); bundle.putInt("id", searchList.get(position).getId()); Bundle save = castDetails.getSave(); castDetails = new CastDetails(); castDetails.setTimeOut(0); castDetails.setSave(save); castDetails.setArguments(bundle); } else castDetails = new CastDetails(); args = new Bundle(); args.putInt("id", searchList.get(position).getId()); castDetails.setArguments(args); castDetails.setTitle(searchList.get(position).getTitle()); transaction.replace(R.id.frame_container, castDetails); result = true; break; case "tv": activity.setRestoreMovieDetailsAdapterState(true); activity.setRestoreMovieDetailsState(false); if (tvDetails != null && lastVisitedId == searchList.get(position).getId() && tvDetails.getTimeOut() == 0) { // Old movie details retrieve info and re-init component else crash tvDetails.onSaveInstanceState(new Bundle()); Bundle bundle = new Bundle(); bundle.putInt("id", searchList.get(position).getId()); Bundle save = tvDetails.getSave(); tvDetails = new TVDetails(); tvDetails.setTimeOut(0); tvDetails.setSave(save); tvDetails.setArguments(bundle); } else tvDetails = new TVDetails(); args = new Bundle(); args.putInt("id", searchList.get(position).getId()); tvDetails.setArguments(args); tvDetails.setTitle(searchList.get(position).getTitle()); transaction.replace(R.id.frame_container, tvDetails); result = true; break; default: result = false; break; } lastVisitedId = searchList.get(position).getId(); if (result) { // add the current transaction to the back stack: transaction.addToBackStack("movieList"); transaction.commit(); // collapse the search View ((MainActivity) getActivity()).collapseSearchView(); } }
From source file:com.farmerbb.notepad.activity.MainActivity.java
private void showDeleteDialog(boolean clearFilesToDelete) { if (clearFilesToDelete) filesToDelete = null;// www . j a v a 2s . co m Bundle bundle = new Bundle(); bundle.putInt("dialog_title", filesToDelete == null || filesToDelete.length == 1 ? R.string.dialog_delete_button_title : R.string.dialog_delete_button_title_plural); DialogFragment deleteFragment = new DeleteDialogFragment(); deleteFragment.setArguments(bundle); deleteFragment.show(getSupportFragmentManager(), "delete"); }