Java Code Examples for android.os.Bundle.putInt()

The following are Jave code examples for showing how to use putInt() of the android.os.Bundle class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ChangeTabLayout   File:   Source Code and License Vote up 6 votes
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ViewPager mViewPager = (ViewPager) view.findViewById(;
    FragmentPagerItems pages = new FragmentPagerItems(getActivity());
    final int page = FragmentPagerItem.getPosition(getArguments());

    for (int i = 0; i < 5; i++) {
        Bundle bundle = new Bundle();
        bundle.putInt("page", page);
        bundle.putInt("position", i);
        pages.add(FragmentPagerItem.of(String.valueOf(i), DemoFragment.class, bundle));
    FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(getChildFragmentManager(), pages); //Fragment嵌套Fragment时,要用getChildFragmentManager
    final MainActivity mainActivity = (MainActivity) getActivity();
    mViewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
            mainActivity.pageScrolled(page, position, positionOffset);
Example 2
Project: chuck   File:   Source Code and License Vote up 6 votes
public static TransactionPayloadFragment newInstance(int type) {
    TransactionPayloadFragment fragment = new TransactionPayloadFragment();
    Bundle b = new Bundle();
    b.putInt(ARG_TYPE, type);
    return fragment;
Example 3
Project: pius1   File:   Source Code and License Vote up 6 votes
protected Parcelable onSaveInstanceState() {
    final Bundle bundle = new Bundle();
    bundle.putParcelable(INSTANCE_STATE, super.onSaveInstanceState());
    bundle.putInt(INSTANCE_TEXT_COLOR, getTextColor());
    bundle.putFloat(INSTANCE_TEXT_SIZE, getProgressTextSize());
    bundle.putFloat(INSTANCE_REACHED_BAR_HEIGHT, getReachedBarHeight());
    bundle.putFloat(INSTANCE_UNREACHED_BAR_HEIGHT, getUnreachedBarHeight());
    bundle.putInt(INSTANCE_REACHED_BAR_COLOR, getReachedBarColor());
    bundle.putInt(INSTANCE_UNREACHED_BAR_COLOR, getUnreachedBarColor());
    bundle.putInt(INSTANCE_MAX, getMax());
    bundle.putInt(INSTANCE_PROGRESS, getProgress());
    bundle.putString(INSTANCE_SUFFIX, getSuffix());
    bundle.putString(INSTANCE_PREFIX, getPrefix());
    bundle.putBoolean(INSTANCE_TEXT_VISIBILITY, getProgressTextVisibility());
    return bundle;
Example 4
Project: HutHelper   File:   Source Code and License Vote up 5 votes
public static LostAndFoundFragment newInstance(int type, String searchText) {

        Bundle args = new Bundle();
        args.putInt("type", type);
        if (!TextUtils.isEmpty(searchText)) {
            args.putString("searchText", searchText);
        LostAndFoundFragment fragment = new LostAndFoundFragment();
        return fragment;
Example 5
Project: TFG-SmartU-La-red-social   File:   Source Code and License Vote up 5 votes
 * Usar este constructor para crear una instancia de
 * este fragment con parámetros
 * @param multimedia Parametro 1.
 * @return A devuelve una nueva instancia del fragment.
public static FragmentMultimedia newInstance(ArrayList<Multimedia> multimedia,int idProyecto) {
    FragmentMultimedia fragment = new FragmentMultimedia();
    Bundle args = new Bundle();
    args.putParcelableArrayList(ARG_MULTIMEDIA, multimedia);
    return fragment;
Example 6
Project: Android-Development   File:   Source Code and License Vote up 5 votes
public static PoiListFragment newInstance(String poiName, int categoryId) {
    PoiListFragment fragment = new PoiListFragment();
    Bundle args = new Bundle();
    args.putString("poiName", poiName);
    args.putInt("categoryId", categoryId);
    return fragment;
Example 7
Project: Nird2   File:   Source Code and License Vote up 5 votes
public static ContactChooserFragment newInstance(ContactId id) {

		Bundle args = new Bundle();

		ContactChooserFragment fragment = new ContactChooserFragment();
		args.putInt(CONTACT_ID, id.getInt());
		return fragment;
Example 8
Project: MyCalendar   File:   Source Code and License Vote up 5 votes
public Parcelable onSaveInstanceState() {
    Bundle state = new Bundle();
    state.putParcelable("instanceState", super.onSaveInstanceState());
    state.putInt("alpha", alpha);
    state.putFloat("hue", hue);
    state.putFloat("sat", sat);
    state.putFloat("val", val);
    state.putBoolean("show_alpha", showAlphaPanel);
    state.putString("alpha_text", alphaSliderText);

    return state;
Example 9
Project: letv   File:   Source Code and License Vote up 5 votes
protected final Parcelable onSaveInstanceState() {
    Bundle bundle = new Bundle();
    bundle.putInt(STATE_STATE, this.mState.getIntValue());
    bundle.putInt(STATE_MODE, this.mMode.getIntValue());
    bundle.putInt(STATE_CURRENT_MODE, this.mCurrentMode.getIntValue());
    bundle.putBoolean(STATE_SCROLLING_REFRESHING_ENABLED, this.mScrollingWhileRefreshingEnabled);
    bundle.putBoolean(STATE_SHOW_REFRESHING_VIEW, this.mShowViewWhileRefreshing);
    bundle.putParcelable(STATE_SUPER, super.onSaveInstanceState());
    return bundle;
Example 10
Project: aarLibrary   File:   Source Code and License Vote up 5 votes
protected Parcelable onSaveInstanceState() {
    Bundle bundle = new Bundle();
    bundle.putParcelable("instanceState", super.onSaveInstanceState());
    bundle.putInt("mCurrentTab", mCurrentTab);
    return bundle;
Example 11
Project: A.scribe   File:   Source Code and License Vote up 5 votes
public static NoteFragment newInstance(Note note, int position) {
    NoteFragment noteFragment = new NoteFragment();
    Bundle arguments = new Bundle();
    arguments.putParcelable(ARG_NOTE, note);
    arguments.putInt(ARG_POSITION, position);
    return noteFragment;
Example 12
Project: anitrend-app   File:   Source Code and License Vote up 5 votes
protected void onSaveInstanceState(Bundle outState) {
    outState.putSerializable(MODEL_SAVE_KEY, mModel);
    outState.putInt(NAVIGATION_POSITION, mNavigationIndex);
    outState.putParcelable(MODEL_USER_KEY, mCurrentUser);
    outState.putInt(SHORTCUT_NAVIGATION, mShortcut);
    outState.putLong(TIME_ELAPSE_TRIGGER, mLastSynced);
    outState.putInt(VIEW_PAGER_OFF_SCREEN, mOffScreenLimit);
Example 13
Project: SimpleDialogFragments   File:   Source Code and License Vote up 5 votes
protected Bundle onResult(int which) {
    Bundle results = new Bundle();
    results.putInt(HOUR, picker.getCurrentHour());
    results.putInt(MINUTE, picker.getCurrentMinute());
    return results;
Example 14
Project: underlx   File:   Source Code and License Vote up 5 votes
public static TripHistoryFragment newInstance(int columnCount) {
    TripHistoryFragment fragment = new TripHistoryFragment();
    Bundle args = new Bundle();
    args.putInt(ARG_COLUMN_COUNT, columnCount);
    return fragment;
Example 15
Project: Melophile   File:   Source Code and License Vote up 4 votes
public Bundle toBundle(){
    Bundle bundle=new Bundle();
    return bundle;
Example 16
Project: Matisse   File:   Source Code and License Vote up 4 votes
public void onSaveInstanceState(Bundle outState) {
    outState.putInt(STATE_CURRENT_SELECTION, mCurrentSelection);
Example 17
Project: Library-System-Android   File:   Source Code and License Vote up 4 votes
public void onClick(View v) {
    Spinner monthSpinner = (Spinner) findViewById(;
    Spinner daySpinner = (Spinner) findViewById(;
    Spinner yearSpinner = (Spinner) findViewById(;
    Spinner hourSpinner = (Spinner) findViewById(;
    Spinner ampmSpinner = (Spinner) findViewById(;

    String month = monthSpinner.getSelectedItem().toString();
    String day = daySpinner.getSelectedItem().toString();
    String year = yearSpinner.getSelectedItem().toString();
    String hour = hourSpinner.getSelectedItem().toString();
    String ampm = ampmSpinner.getSelectedItem().toString();

    //Create a new date to pass down to confirmation and for math to calculate cost
    Date date = new Date(month,day,year);
    //Daynumber for cost calc and day save
    int dayNumber = date.getDayNumber();
    System.out.println("Day Number: " + dayNumber);

    ********************UnComment to disallow rentals before the Current Date************************
    Calendar calendar = Calendar.getInstance();
    int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);
    int currentYear = calendar.get(Calendar.YEAR);

    System.out.println("Day of the year today: " + dayOfYear);
        System.out.println("You picked a date in the past ");
        AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this);
        dlgAlert.setMessage("Sorry, The Chosen Date Has Passed! Try Again");
        dlgAlert.setTitle("Otter Library System");
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {

        //Passes All info to the next page DropOff
        Intent I = new Intent(getApplicationContext(), DropOff.class);
        Bundle extraInfo = new Bundle();

        extraInfo.putInt("pickUpDayOfYear", dayNumber);
        extraInfo.putString("pickUpMonth", month);
        extraInfo.putString("pickUpDay", day);
        extraInfo.putString("pickUpYear", year);
        extraInfo.putString("pickUpHour", hour);
        extraInfo.putString("pickUpAmPm", ampm);
Example 18
Project: MDWechat   File:   Source Code and License Vote up 4 votes
@Override public void onSaveInstanceState(Bundle outState) {
  outState.putInt(ARG_COLOR, color);
  outState.putInt(ARG_TYPE, dialogType);
Example 19
Project: AndroidBackendlessChat   File:   Source Code and License Vote up 4 votes
public void onClick(View v) {
    Context context = getContext();
    final Session openSession = sessionTracker.getOpenSession();

    if (openSession != null) {
        // If the Session is currently open, it must mean we need to log out
        if (confirmLogout) {
            // Create a confirmation dialog
            String logout = getResources().getString(R.string.com_facebook_loginview_log_out_action);
            String cancel = getResources().getString(R.string.com_facebook_loginview_cancel_action);
            String message;
            if (user != null && user.getName() != null) {
                message = String.format(getResources().getString(R.string.com_facebook_loginview_logged_in_as), user.getName());
            } else {
                message = getResources().getString(R.string.com_facebook_loginview_logged_in_using_facebook);
            AlertDialog.Builder builder = new AlertDialog.Builder(context);
                   .setPositiveButton(logout, new DialogInterface.OnClickListener() {
                       public void onClick(DialogInterface dialog, int which) {
                   .setNegativeButton(cancel, null);
        } else {
    } else {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(context).setApplicationId(applicationId).build();
            currentSession = session;
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = null;
            if (parentFragment != null) {
                openRequest = new Session.OpenRequest(parentFragment);
            } else if (context instanceof Activity) {
                openRequest = new Session.OpenRequest((Activity)context);

            if (openRequest != null) {

                if (SessionAuthorizationType.PUBLISH.equals(properties.authorizationType)) {
                } else {

    AppEventsLogger logger = AppEventsLogger.newLogger(getContext());

    Bundle parameters = new Bundle();
    parameters.putInt("logging_in", (openSession != null) ? 0 : 1);

    logger.logSdkEvent(loginLogoutEventName, null, parameters);

    if (listenerCallback != null) {
Example 20
Project: Appmatic-Android   File:   Source Code and License Vote up 4 votes
public void onSaveInstanceState(Bundle outState) {
    outState.putInt(SELECTED_GROUP_EXTRA, selectedGroup);
    outState.putString(LAST_TITLE_EXTRA, getActivity().getTitle().toString());