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.
+ Save this method
Example 1
Project: ChangeTabLayout   File: PageFragment.java   View Source Code Vote up 6 votes
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ViewPager mViewPager = (ViewPager) view.findViewById(R.id.vp);
    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
    mViewPager.setAdapter(adapter);
    mViewPager.setOffscreenPageLimit(2);
    mViewPager.setPageMargin(30);
    final MainActivity mainActivity = (MainActivity) getActivity();
    mViewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
            mainActivity.pageScrolled(page, position, positionOffset);
        }
    });
}
 
Example 2
Project: chuck   File: TransactionPayloadFragment.java   View Source Code Vote up 6 votes
public static TransactionPayloadFragment newInstance(int type) {
    TransactionPayloadFragment fragment = new TransactionPayloadFragment();
    Bundle b = new Bundle();
    b.putInt(ARG_TYPE, type);
    fragment.setArguments(b);
    return fragment;
}
 
Example 3
Project: pius1   File: Num.java   View Source Code Vote up 6 votes
@Override
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: LostAndFoundFragment.java   View Source Code 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();
        fragment.setArguments(args);
        return fragment;
    }
 
Example 5
Project: TFG-SmartU-La-red-social   File: FragmentMultimedia.java   View Source Code 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);
    args.putInt(ARG_IDPROYECTO,idProyecto);
    fragment.setArguments(args);
    return fragment;
}
 
Example 6
Project: Android-Development   File: PoiListFragment.java   View Source Code 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);
    fragment.setArguments(args);
    return fragment;
}
 
Example 7
Project: Nird2   File: ContactChooserFragment.java   View Source Code Vote up 5 votes
public static ContactChooserFragment newInstance(ContactId id) {

		Bundle args = new Bundle();

		ContactChooserFragment fragment = new ContactChooserFragment();
		args.putInt(CONTACT_ID, id.getInt());
		fragment.setArguments(args);
		return fragment;
	}
 
Example 8
Project: MyCalendar   File: ColorPickerView.java   View Source Code Vote up 5 votes
@Override
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: PullToRefreshBase.java   View Source Code Vote up 5 votes
protected final Parcelable onSaveInstanceState() {
    Bundle bundle = new Bundle();
    onPtrSaveInstanceState(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: SlidingTabLayout.java   View Source Code Vote up 5 votes
@Override
protected Parcelable onSaveInstanceState() {
    Bundle bundle = new Bundle();
    bundle.putParcelable("instanceState", super.onSaveInstanceState());
    bundle.putInt("mCurrentTab", mCurrentTab);
    return bundle;
}
 
Example 11
Project: A.scribe   File: NoteFragment.java   View Source Code 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);
    noteFragment.setArguments(arguments);
    return noteFragment;
}
 
Example 12
Project: anitrend-app   File: MainActivity.java   View Source Code Vote up 5 votes
@Override
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);
    super.onSaveInstanceState(outState);
}
 
Example 13
Project: SimpleDialogFragments   File: SimpleTimeDialog.java   View Source Code Vote up 5 votes
@SuppressWarnings("deprecation")
@Override
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: TripHistoryFragment.java   View Source Code Vote up 5 votes
@SuppressWarnings("unused")
public static TripHistoryFragment newInstance(int columnCount) {
    TripHistoryFragment fragment = new TripHistoryFragment();
    Bundle args = new Bundle();
    args.putInt(ARG_COLUMN_COUNT, columnCount);
    fragment.setArguments(args);
    return fragment;
}
 
Example 15
Project: Melophile   File: MoreMediaEvent.java   View Source Code Vote up 4 votes
public Bundle toBundle(){
    Bundle bundle=new Bundle();
    bundle.putBundle(Constants.EXTRA_DATA,data);
    bundle.putInt(Constants.EXTRA_CODE,code);
    return bundle;
}
 
Example 16
Project: Matisse   File: AlbumCollection.java   View Source Code Vote up 4 votes
public void onSaveInstanceState(Bundle outState) {
    outState.putInt(STATE_CURRENT_SELECTION, mCurrentSelection);
}
 
Example 17
Project: Library-System-Android   File: PlaceHold.java   View Source Code Vote up 4 votes
public void onClick(View v) {
    Spinner monthSpinner = (Spinner) findViewById(R.id.month_spinner);
    Spinner daySpinner = (Spinner) findViewById(R.id.day_spinner);
    Spinner yearSpinner = (Spinner) findViewById(R.id.year_spinner);
    Spinner hourSpinner = (Spinner) findViewById(R.id.hour_spinner);
    Spinner ampmSpinner = (Spinner) findViewById(R.id.ampm_spinner);


if(v.getId()==R.id.choosedate_button){
    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);
    if(dayNumber<dayOfYear&&year.equals(Integer.toString(currentYear))){
        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");
        dlgAlert.setPositiveButton("OK",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                    }
                });
        dlgAlert.setCancelable(true);
        dlgAlert.create().show();
    }
    else{*/

        //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);
        I.putExtras(extraInfo);
        startActivity(I);
    }
}
 
Example 18
Project: MDWechat   File: ColorPickerDialog.java   View Source Code Vote up 4 votes
@Override public void onSaveInstanceState(Bundle outState) {
  outState.putInt(ARG_COLOR, color);
  outState.putInt(ARG_TYPE, dialogType);
  super.onSaveInstanceState(outState);
}
 
Example 19
Project: AndroidBackendlessChat   File: LoginButton.java   View Source Code Vote up 4 votes
@Override
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);
            builder.setMessage(message)
                   .setCancelable(true)
                   .setPositiveButton(logout, new DialogInterface.OnClickListener() {
                       public void onClick(DialogInterface dialog, int which) {
                           openSession.closeAndClearTokenInformation();
                       }
                   })
                   .setNegativeButton(cancel, null);
            builder.create().show();
        } else {
            openSession.closeAndClearTokenInformation();
        }
    } else {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            sessionTracker.setSession(null);
            Session session = new Session.Builder(context).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            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) {
                openRequest.setDefaultAudience(properties.defaultAudience);
                openRequest.setPermissions(properties.permissions);
                openRequest.setLoginBehavior(properties.loginBehavior);

                if (SessionAuthorizationType.PUBLISH.equals(properties.authorizationType)) {
                    currentSession.openForPublish(openRequest);
                } else {
                    currentSession.openForRead(openRequest);
                }
            }
        }
    }

    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) {
        listenerCallback.onClick(v);
    }
}
 
Example 20
Project: Appmatic-Android   File: GalleryFragment.java   View Source Code Vote up 4 votes
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt(SELECTED_GROUP_EXTRA, selectedGroup);
    outState.putString(LAST_TITLE_EXTRA, getActivity().getTitle().toString());
}