List of usage examples for android.os Bundle putBoolean
public void putBoolean(@Nullable String key, boolean value)
From source file:co.taqat.call.assistant.AssistantActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { outState.putSerializable("CurrentFragment", currentFragment); outState.putBoolean("echoCanceller", echoCancellerAlreadyDone); super.onSaveInstanceState(outState); }
From source file:com.krayzk9s.imgurholo.activities.ImageActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getActionBar() != null) getActionBar().setDisplayHomeAsUpEnabled(true); if (savedInstanceState == null) { Intent intent = getIntent();//from www .ja va2s . co m Log.d("intent", intent.getExtras().getParcelable("id").toString()); JSONObject id = ((JSONParcelable) intent.getExtras().getParcelable("id")).getJSONObject(); try { if (id.has("is_album") && id.getBoolean("is_album")) { ImagesFragment fragment = new ImagesFragment(); Bundle bundle = new Bundle(); bundle.putString("imageCall", "3/album/" + id.getString("id")); bundle.putString("id", id.getString("id")); JSONParcelable data = new JSONParcelable(); data.setJSONObject(id); bundle.putParcelable("albumData", data); fragment.setArguments(bundle); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.frame_layout, fragment).commitAllowingStateLoss(); } else { SingleImageFragment singleImageFragment = new SingleImageFragment(); Bundle bundle = new Bundle(); bundle.putBoolean("gallery", true); JSONParcelable data = new JSONParcelable(); data.setJSONObject(id); bundle.putParcelable("imageData", data); singleImageFragment.setArguments(bundle); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.frame_layout, singleImageFragment).commitAllowingStateLoss(); } } catch (JSONException e) { Log.e("Error!", e.toString()); } } }
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 ww .ja v a 2 s.c om*/ return bundle; }
From source file:com.hackensack.umc.activity.ProfileActivity.java
@Override public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) { super.onSaveInstanceState(outState, outPersistentState); outState.putBoolean(Constant.PROFILE_DIALOG, isDialogAlertShown); putUrlValuesInBundle(outState);//from w w w. j a va 2 s. c om }
From source file:ca.farrelltonsolar.classic.ModbusTask.java
public Bundle getChargeControllerInformation() throws ModbusException { Bundle result = new Bundle(); DeviceType deviceType = lookForTriStar(); result.putSerializable("DeviceType", deviceType); if (deviceType == DeviceType.Classic) { result.putString("UnitName", getUnitName()); result.putInt("UnitID", getUnitID()); result.putBoolean("FoundWhizbang", lookForWhizBangJr()); } else {/*from w ww . j a v a 2 s. c o m*/ result.putString("UnitName", "Tristar"); result.putInt("UnitID", 0); } return result; }
From source file:cw.kop.autobackground.sources.SourceInfoFragment.java
private void showImageFragment(boolean setPath, String viewPath, int position, boolean use) { LocalImageFragment localImageFragment = new LocalImageFragment(); Bundle arguments = new Bundle(); arguments.putBoolean("set_path", setPath); arguments.putString("view_path", viewPath); arguments.putInt("position", position); arguments.putBoolean("use", use); localImageFragment.setArguments(arguments); localImageFragment.setTargetFragment(this, -1); getFragmentManager().beginTransaction().add(R.id.content_frame, localImageFragment, "image_fragment") .addToBackStack(null).commit(); }
From source file:de.da_sense.moses.client.FormFragment.java
@Override public void onSaveInstanceState(Bundle outState) { // save the formID for the future outState.putInt(Form.KEY_FORM_ID, mFormID); outState.putString(InstalledExternalApplication.KEY_APK_ID, mAPKID); outState.putBoolean(KEY_IS_FIRST, mIsFirst); outState.putBoolean(KEY_IS_LAST, mIsLast); outState.putInt(KEY_POSITION, mPosition); super.onSaveInstanceState(outState); }
From source file:de.sourcestream.movieDB.controller.MovieList.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. */// ww w.j a v a 2 s . c om @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) outState.putBundle("save", save); else { Bundle send = new Bundle(); send.putInt("checkLoadMore", checkLoadMore); send.putInt("totalPages", totalPages); send.putString("currentListURL", getCurrentList()); send.putString("title", getTitle()); send.putBoolean("isLoading", isLoading); send.putInt("lastVisitedMovie", lastVisitedMovie); if (backState == 1) { send.putInt("backState", 1); send.putParcelableArrayList("listData", moviesList); // used to restore the scroll listener variables send.putInt("currentPage", endlessScrollListener.getCurrentPage()); send.putInt("oldCount", endlessScrollListener.getOldCount()); send.putBoolean("loading", endlessScrollListener.getLoading()); // Save scroll position if (listView != null) { Parcelable listState = listView.onSaveInstanceState(); send.putParcelable("listViewScroll", listState); } } else send.putInt("backState", 0); outState.putBundle("save", send); } }
From source file:uk.bowdlerize.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. switch (item.getItemId()) { case R.id.action_add: { AlertDialog.Builder builder = new AlertDialog.Builder(this); // Get the layout inflater LayoutInflater inflater = getLayoutInflater(); View dialogView = inflater.inflate(R.layout.dialog_add_url, null); final EditText urlET = (EditText) dialogView.findViewById(R.id.urlET); builder.setView(dialogView)/*from w ww . ja va 2s .co m*/ .setPositiveButton(R.string.action_add, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { Bundle extras = new Bundle(); Intent receiveURLIntent = new Intent(MainActivity.this, CensorCensusService.class); extras.putString("url", urlET.getText().toString()); extras.putString("hash", MD5(urlET.getText().toString())); extras.putInt("urgency", 0); extras.putBoolean("local", true); //Add our extra info if (getSharedPreferences(MainActivity.class.getSimpleName(), Context.MODE_PRIVATE) .getBoolean("sendISPMeta", true)) { WifiManager wifiMgr = (WifiManager) getSystemService(Context.WIFI_SERVICE); WifiInfo wifiInfo = wifiMgr.getConnectionInfo(); TelephonyManager telephonyManager = ((TelephonyManager) getSystemService( Context.TELEPHONY_SERVICE)); if (wifiMgr.isWifiEnabled() && null != wifiInfo.getSSID()) { LocalCache lc = null; Pair<Boolean, String> seenBefore = null; try { lc = new LocalCache(MainActivity.this); lc.open(); seenBefore = lc.findSSID(wifiInfo.getSSID().replaceAll("\"", "")); } catch (Exception e) { e.printStackTrace(); } if (null != lc) lc.close(); if (seenBefore.first) { extras.putString("isp", seenBefore.second); } else { extras.putString("isp", "unknown"); } try { extras.putString("sim", telephonyManager.getSimOperatorName()); } catch (Exception e) { e.printStackTrace(); } } else { try { extras.putString("isp", telephonyManager.getNetworkOperatorName()); } catch (Exception e) { e.printStackTrace(); } try { extras.putString("sim", telephonyManager.getSimOperatorName()); } catch (Exception e) { e.printStackTrace(); } } } receiveURLIntent.putExtras(extras); startService(receiveURLIntent); dialog.cancel(); } }).setNegativeButton(R.string.action_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); builder.show(); return true; } } return super.onOptionsItemSelected(item); }
From source file:app.hacked.ScheduleListItemDetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_schedule_detail); final ActionBar actionBar = getActionBar(); actionBar.setSubtitle("This app is UNOFFICIAL use at your own risk"); actionBar.setDisplayHomeAsUpEnabled(true); // savedInstanceState is non-null when there is fragment state // saved from previous configurations of this activity // (e.g. when rotating the screen from portrait to landscape). // In this case, the fragment will automatically be re-added // to its container so we don't need to manually add it. // For more information, see the Fragments API guide at: ////from w ww.ja va2 s .co m // http://developer.android.com/guide/components/fragments.html // if (savedInstanceState == null) { // Create the detail fragment and add it to the activity // using a fragment transaction. Bundle arguments = new Bundle(); arguments.putString(ScheduleItemDetailFragment.SCHEDULETITLE, getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULETITLE)); arguments.putString(ScheduleItemDetailFragment.SCHEDULEID, getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULEID)); arguments.putString(ScheduleItemDetailFragment.SCHEDULEFULLDATAHTML, getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULEFULLDATAHTML)); arguments.putString(ScheduleItemDetailFragment.SCHEDULESTARTTIME, getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULESTARTTIME)); arguments.putString(ScheduleItemDetailFragment.SCHEDULEDESC, getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULEDESC)); arguments.putBoolean(ScheduleItemDetailFragment.ISDAYTITLE, getIntent().getBooleanExtra(ScheduleItemDetailFragment.ISDAYTITLE, false)); arguments.putString(ScheduleItemDetailFragment.SCHEDULEENDTIME, getIntent().getStringExtra(ScheduleItemDetailFragment.SCHEDULEENDTIME)); arguments.putBoolean(ScheduleItemDetailFragment.ARG_2PANE, getIntent().getBooleanExtra(ScheduleItemDetailFragment.ARG_2PANE, false)); ScheduleItemDetailFragment fragment = new ScheduleItemDetailFragment(); fragment.setArguments(arguments); getSupportFragmentManager().beginTransaction().replace(R.id.ScheduleDetails, fragment).commit(); } }