List of usage examples for android.os Bundle getBoolean
public boolean getBoolean(String key)
From source file:com.lepin.activity.MyOrderDetailActivity.java
/** * ?/*from w w w. ja va2 s.c o m*/ */ private void initView() { final Bundle bundle = getIntent().getExtras(); this.book_id = bundle.getString(Constant.BOOK_ID); this.mStartLat = bundle.getInt(Constant.START_LAT); this.mStartLon = bundle.getInt(Constant.START_LON); this.mEndLat = bundle.getInt(Constant.END_LAT); this.mEndLon = bundle.getInt(Constant.END_LON); isShowCalendar = bundle.getBoolean(Constant.SHOW_CALENDAR); Util.printLog("bookId:" + book_id); this.tvTitle.setText(getResources().getString(R.string.order_details_title));// ?title this.btnBack.setOnClickListener(this); this.btnShare.setOnClickListener(this); this.mPhoneButton.setOnClickListener(this); this.mCancleDriverBtn.setOnClickListener(this); mTwoCancelBtn.setOnClickListener(this); mTwoPayOrInBtn.setOnClickListener(this); mapImageView.setOnClickListener(this); mPhotoView.setOnClickListener(this); }
From source file:com.google.sample.castcompanionlibrary.cast.player.VideoCastControllerFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mCastConsumer = new MyCastConsumer(); Bundle bundle = getArguments();/*from w ww . j a v a2 s . c o m*/ if (null == bundle) { return; } Bundle extras = bundle.getBundle(EXTRAS); Bundle mediaWrapper = extras.getBundle(VideoCastManager.EXTRA_MEDIA); // Retain this fragment across configuration changes. setRetainInstance(true); if (extras.getBoolean(VideoCastManager.EXTRA_HAS_AUTH)) { mOverallState = OverallState.AUTHORIZING; mMediaAuthService = mCastManager.getMediaAuthService(); handleMediaAuthTask(mMediaAuthService); showImage(Utils.getImageUri(mMediaAuthService.getMediaInfo(), 1)); } else if (null != mediaWrapper) { mOverallState = OverallState.PLAYBACK; boolean shouldStartPlayback = extras.getBoolean(VideoCastManager.EXTRA_SHOULD_START); String customDataStr = extras.getString(VideoCastManager.EXTRA_CUSTOM_DATA); JSONObject customData = null; if (!TextUtils.isEmpty(customDataStr)) { try { customData = new JSONObject(customDataStr); } catch (JSONException e) { LOGE(TAG, "Failed to unmarshalize custom data string: customData=" + customDataStr, e); } } MediaInfo info = Utils.toMediaInfo(mediaWrapper); int startPoint = extras.getInt(VideoCastManager.EXTRA_START_POINT, 0); onReady(info, shouldStartPlayback, startPoint, customData); } }
From source file:com.google.android.gms.location.sample.locationupdates.MainActivity.java
/** * Updates fields based on data stored in the bundle. * * @param savedInstanceState The activity state saved in the Bundle. *//*from w ww .j a v a 2s . c o m*/ private void updateValuesFromBundle(Bundle savedInstanceState) { Log.i(TAG, "Updating values from bundle"); if (savedInstanceState != null) { // Update the value of mRequestingLocationUpdates from the Bundle, and make sure that // the Start Updates and Stop Updates buttons are correctly enabled or disabled. if (savedInstanceState.keySet().contains(REQUESTING_LOCATION_UPDATES_KEY)) { mRequestingLocationUpdates = savedInstanceState.getBoolean(REQUESTING_LOCATION_UPDATES_KEY); setButtonsEnabledState(); } // Update the value of mCurrentLocation from the Bundle and update the UI to show the // correct latitude and longitude. if (savedInstanceState.keySet().contains(LOCATION_KEY)) { // Since LOCATION_KEY was found in the Bundle, we can be sure that mCurrentLocation // is not null. mCurrentLocation = savedInstanceState.getParcelable(LOCATION_KEY); } // Update the value of mLastUpdateTime from the Bundle and update the UI. if (savedInstanceState.keySet().contains(LAST_UPDATED_TIME_STRING_KEY)) { mLastUpdateTime = savedInstanceState.getString(LAST_UPDATED_TIME_STRING_KEY); } //updateUI(); } }
From source file:at.wada811.android.dialogfragments.AlertDialogFragment.java
private void setNeutralButton(AlertDialog.Builder builder) { final Bundle args = getArguments(); final CharSequence naturalButtonText = args.getCharSequence(NEUTRAL_BUTTON); if (naturalButtonText == null) { return;//from w ww. ja v a 2 s . co m } final boolean useOnNeutralClickListener = args.getBoolean(NEUTRAL_CLICK_LISTENER); builder.setNeutralButton(naturalButtonText, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (useOnNeutralClickListener) { bindClickListener(which); } } }); }
From source file:at.wada811.android.dialogfragments.AlertDialogFragment.java
private void setPositiveButton(AlertDialog.Builder builder) { final Bundle args = getArguments(); final CharSequence positiveButtonText = args.getCharSequence(POSITIVE_BUTTON); if (positiveButtonText == null) { return;/*from ww w.j a va 2 s . c om*/ } final boolean useOnPositiveClickListener = args.getBoolean(POSITIVE_CLICK_LISTENER); builder.setPositiveButton(positiveButtonText, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (useOnPositiveClickListener) { bindClickListener(which); } } }); }
From source file:at.wada811.android.dialogfragments.AlertDialogFragment.java
private void setNegativeButton(AlertDialog.Builder builder) { final Bundle args = getArguments(); final CharSequence negativeButtonText = args.getCharSequence(NEGATIVE_BUTTON); if (negativeButtonText == null) { return;/*w w w. j ava2 s .c o m*/ } final boolean useOnNegativeClickListener = args.getBoolean(NEGATIVE_CLICK_LISTENER); builder.setNegativeButton(negativeButtonText, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (useOnNegativeClickListener) { bindClickListener(which); } } }); }
From source file:com.android.contacts.group.GroupMembersFragment.java
@Override public void onCreate(Bundle savedState) { super.onCreate(savedState); if (savedState == null) { mGroupUri = getArguments().getParcelable(ARG_GROUP_URI); } else {//from www. j av a 2 s .com mIsEditMode = savedState.getBoolean(KEY_IS_EDIT_MODE); mGroupUri = savedState.getParcelable(KEY_GROUP_URI); mGroupMetaData = savedState.getParcelable(KEY_GROUP_METADATA); } maybeAttachCheckBoxListener(); }
From source file:com.dudka.rich.streamingmusicplayer.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Fresco.initialize(this); FragmentManager fm = getSupportFragmentManager(); musicPlayerUI = (FragmentMusicPlayerUI) fm.findFragmentByTag(fragmentTag); if (savedInstanceState == null) { FragmentTransaction ft = fm.beginTransaction(); ft.add(R.id.fragment_container, FragmentMusicPlayerUI.newInstance(), fragmentTag); ft.commit();//from www .java 2 s. co m fm.executePendingTransactions(); musicPlayerUI = (FragmentMusicPlayerUI) fm.findFragmentByTag(fragmentTag); } boolean changingConfig = false; if (savedInstanceState != null) { changingConfig = savedInstanceState.getBoolean(IS_CHANGING_CONFIGURATIONS); isPlaying = savedInstanceState.getBoolean("isPlaying"); songName = savedInstanceState.getString("songName"); artistName = savedInstanceState.getString("artistName", artistName); coverImage = savedInstanceState.getString("coverImage", coverImage); } if (!changingConfig) handleVolley(); }
From source file:cmput301.f13t01.editstory.EditStoryActivity.java
@Override /**// ww w. ja va2 s . c o m * Override onCreate function */ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_story); getActionBar().setDisplayHomeAsUpEnabled(false); final Button button = (Button) findViewById(R.id.edit_set_first_page); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { buttonPressed = true; showFragmentSelection(); } }); // Get the story manager GlobalManager app = (GlobalManager) getApplication(); manager = GlobalManager.getStoryManager(); if (savedInstanceState != null) { isNew = savedInstanceState.getBoolean(getResources().getString(R.string.story_is_new)); storyId = (UUID) savedInstanceState.getSerializable(getResources().getString(R.string.story_id)); app.setStoryManager(storyId); } else { Intent intent = getIntent(); isNew = (boolean) intent.getBooleanExtra(getResources().getString(R.string.story_is_new), false); if (isNew == false) { storyId = (UUID) intent.getSerializableExtra(getResources().getString(R.string.story_id)); app.setStoryManager(storyId); EditText title = (EditText) findViewById(R.id.edit_story_title); EditText author = (EditText) findViewById(R.id.edit_story_author); EditText desc = (EditText) findViewById(R.id.edit_story_description); title.setText(manager.getTitle()); author.setText(manager.getAuthor()); desc.setText(manager.getDescription()); } else { storyId = app.createAndSetStory(); } } TextView firstPage = (TextView) findViewById(R.id.edit_first_page); StoryFragment firstPageFragment = manager.getFirstPage(); if (firstPageFragment == null) { firstPage.setText(getResources().getString(R.string.first_page) + " " + getResources().getString(R.string.first_page_empty)); } else { firstPage.setText( getResources().getString(R.string.first_page) + " " + manager.getFirstPage().getTitle()); } }