本文整理汇总了Java中android.os.Bundle.putInt方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.putInt方法的具体用法?Java Bundle.putInt怎么用?Java Bundle.putInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Bundle
的用法示例。
在下文中一共展示了Bundle.putInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onViewCreated
import android.os.Bundle; //导入方法依赖的package包/类
@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);
}
});
}
示例2: newInstance
import android.os.Bundle; //导入方法依赖的package包/类
public static TransactionPayloadFragment newInstance(int type) {
TransactionPayloadFragment fragment = new TransactionPayloadFragment();
Bundle b = new Bundle();
b.putInt(ARG_TYPE, type);
fragment.setArguments(b);
return fragment;
}
示例3: onSaveInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@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;
}
示例4: onSaveInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@Override public void onSaveInstanceState(Bundle outState) {
outState.putInt(ARG_COLOR, color);
outState.putInt(ARG_TYPE, dialogType);
super.onSaveInstanceState(outState);
}
示例5: newInstance
import android.os.Bundle; //导入方法依赖的package包/类
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;
}
示例6: newInstance
import android.os.Bundle; //导入方法依赖的package包/类
/**
* 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;
}
示例7: newInstance
import android.os.Bundle; //导入方法依赖的package包/类
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;
}
示例8: newInstance
import android.os.Bundle; //导入方法依赖的package包/类
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;
}
示例9: onSaveInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@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;
}
示例10: onSaveInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
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;
}
示例11: onSaveInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected Parcelable onSaveInstanceState() {
Bundle bundle = new Bundle();
bundle.putParcelable("instanceState", super.onSaveInstanceState());
bundle.putInt("mCurrentTab", mCurrentTab);
return bundle;
}
示例12: newInstance
import android.os.Bundle; //导入方法依赖的package包/类
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;
}
示例13: onSaveInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@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);
}
示例14: onResult
import android.os.Bundle; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected Bundle onResult(int which) {
Bundle results = new Bundle();
results.putInt(HOUR, picker.getCurrentHour());
results.putInt(MINUTE, picker.getCurrentMinute());
return results;
}
示例15: newInstance
import android.os.Bundle; //导入方法依赖的package包/类
@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;
}