List of usage examples for android.os Bundle getIntArray
@Nullable public int[] getIntArray(@Nullable String key)
From source file:ca.hoogit.soundchooser.SoundChooserDialog.java
@Override @SuppressWarnings("ConstantConditions") public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mTitle = getArguments().getString(KEY_TITLE); mCircleColor = getArguments().getInt(KEY_CIRCLE_COLOR); mColumns = getArguments().getInt(KEY_COLUMNS); mSize = getArguments().getInt(KEY_SIZE); }//from w w w . j av a 2 s . c o m if (savedInstanceState != null) { mSounds = savedInstanceState.getIntArray(KEY_SOUNDS); mSelectedSound = (Integer) savedInstanceState.getSerializable(KEY_SELECTED_SOUND); } }
From source file:nz.ac.otago.psyanlab.common.designer.program.ProgramFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mScroller = (HorizontalScrollView) view.findViewById(R.id.scroll); mScroller.setSmoothScrollingEnabled(true); mFragments = new ArrayList<BaseProgramFragment>(); if (savedInstanceState == null) { setNextFragment(null, new LoopsListFragment()); } else {//from ww w. j av a2s .c o m // Reconstruct our fragment state. int[] ids = savedInstanceState.getIntArray(KEY_FRAG_IDS); FragmentManager cfm = getChildFragmentManager(); for (int id : ids) { BaseProgramFragment f = (BaseProgramFragment) cfm.findFragmentByTag("program_frag" + id); f.setScrollerPos(mFragments.size()); f.setScrollerManager(this); mFragments.add(f); } // Ensure fragments are attached in the correct order. FragmentTransaction ft = cfm.beginTransaction(); for (Fragment f : mFragments) { ft.detach(f); } ft.commit(); cfm.executePendingTransactions(); for (Fragment f : mFragments) { FragmentTransaction t = cfm.beginTransaction(); t.attach(f); t.commit(); cfm.executePendingTransactions(); } int position = savedInstanceState.getInt(KEY_SCROLL_POSITION, 0); requestInstantMoveTo(position); } }
From source file:com.kiwi.auready.util.view.ColorPickerDialog.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mTitleResId = getArguments().getInt(KEY_TITLE_ID); mColors = getArguments().getIntArray(KEY_COLORS); mSelectedColor = getArguments().getInt(KEY_SELECTED_COLOR); mColumns = getArguments().getInt(KEY_COLUMNS); mSize = getArguments().getInt(KEY_SIZE); }//from w ww . j ava 2 s . c om if (savedInstanceState != null) { mColors = savedInstanceState.getIntArray(KEY_COLORS); mSelectedColor = savedInstanceState.getInt(KEY_SELECTED_COLOR); mColorContentDescriptions = savedInstanceState.getStringArray(KEY_COLOR_CONTENT_DESCRIPTIONS); } }
From source file:ca.mudar.mtlaucasou.BaseMapFragment.java
/** * Create the map view and restore saved instance (if any). {@inheritDoc} */// ww w. ja va2s . co m @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { /** * Restore map center and zoom */ int savedZoom = ZOOM_DEFAULT; if (savedInstanceState != null) { if (savedInstanceState.containsKey(Const.KEY_INSTANCE_COORDS)) { int[] coords = savedInstanceState.getIntArray(Const.KEY_INSTANCE_COORDS); mMapCenter = new GeoPoint(coords[0], coords[1]); } if (savedInstanceState.containsKey(Const.KEY_INSTANCE_ZOOM)) { savedZoom = savedInstanceState.getInt(Const.KEY_INSTANCE_ZOOM); } } View root = inflater.inflate(R.layout.fragment_map, container, false); mMapView = (MapView) root.findViewById(R.id.map_view); mMapView.setBuiltInZoomControls(true); mMapController = mMapView.getController(); mMapController.setZoom(savedZoom); mLocationManager = (LocationManager) getActivity().getApplicationContext() .getSystemService(MapActivity.LOCATION_SERVICE); initMap(); return root; }
From source file:com.tatteam.patente.ui.fragment.CorreggiFragment.java
private void loadData() { listExamsCorrect = new ArrayList<>(); listExamsWrong = new ArrayList<>(); Bundle dataBundle = getArguments(); if (dataBundle != null) { categoryId = dataBundle.getInt(BUNDLE_CATEGORY_ID, -1); sheetNo = dataBundle.getInt(BUNDLE_SHEET_NO, -1); duration = dataBundle.getInt(BUNDLE_TIME, -1); listExams = DataSource.getExamList(categoryId, sheetNo); int[] answers = dataBundle.getIntArray(BUNDLE_ANSWER); for (int i = 0; i < listExams.size(); i++) { ExamsEntity examsEntity = listExams.get(i); examsEntity.myAnswer = answers[i]; if (examsEntity.myAnswer == examsEntity.answer) { listExamsCorrect.add(examsEntity); } else { listExamsWrong.add(examsEntity); }/*from w w w .ja va 2 s. co m*/ } } }
From source file:com.money.manager.ex.reports.IncomeVsExpensesListFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setHasOptionsMenu(true);//from w ww.j a va 2s . co m if (savedInstanceState != null && savedInstanceState.containsKey(KEY_BUNDLE_YEAR) && savedInstanceState.getIntArray(KEY_BUNDLE_YEAR) != null) { for (int year : savedInstanceState.getIntArray(KEY_BUNDLE_YEAR)) { mYearsSelected.put(year, true); } } else { mYearsSelected.put(Calendar.getInstance().get(Calendar.YEAR), true); } initializeListView(); // set home button // ActionBarActivity activity = (ActionBarActivity) getActivity(); // AppCompatActivity activity = (AppCompatActivity) getActivity(); // if (activity != null) { //activity.getSupportActionBar().setDisplayHomeAsUpEnabled(false); // } // create adapter IncomeVsExpensesAdapter adapter = new IncomeVsExpensesAdapter(getActivity(), null); setListAdapter(adapter); setListShown(false); // start loader //getLoaderManager().restartLoader(ID_LOADER_YEARS, null, this); getLoaderManager().initLoader(ID_LOADER_YEARS, null, this); }
From source file:com.fast.access.kam.widget.colorpicker.dashclockpicker.ColorPickerDialogDash.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); View rootView = layoutInflater.inflate(R.layout.dash_dialog_colors, null); if (getArguments() != null) { mTitleResId = getArguments().getInt(KEY_TITLE_ID); mNumColumns = getArguments().getInt(KEY_COLUMNS); }/*w w w . j a v a 2s . c o m*/ if (savedInstanceState != null) { mColorChoices = savedInstanceState.getIntArray(KEY_COLORS); mSelectedColor = (Integer) savedInstanceState.getSerializable(KEY_SELECTED_COLOR); tryBindLists(); } mColorGrid = (GridView) rootView.findViewById(R.id.color_grid); mColorGrid.setNumColumns(mNumColumns); mColorGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> listView, View view, int position, long itemId) { //Added //Toast.makeText(getActivity(), "Selected color="+mAdapter.getItem(position), Toast.LENGTH_LONG).show(); if (mListener != null) mListener.onColorSelected(mAdapter.getItem(position)); dismiss(); } }); tryBindLists(); return new AlertDialog.Builder(getActivity()).setView(rootView).setTitle(mTitleResId) //Added .create(); }
From source file:com.frostwire.android.gui.activities.MainActivity2.java
private void restoreFragmentsStack(Bundle savedInstanceState) { try {//www. j ava 2 s .com int[] stack = savedInstanceState.getIntArray(FRAGMENTS_STACK_KEY); for (int id : stack) { fragmentsStack.push(id); } } catch (Throwable ignored) { } }
From source file:com.loloof64.android.chess_position_manager.MainActivity.java
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); if (savedInstanceState != null) { directoryManager.tryToGoInAbsoluteFolder(savedInstanceState.getString(CURRENT_ABSOLUTE_PATH_TAG)); setSelectionMode(savedInstanceState.getBoolean(SELECTION_MODE_TAG)); selectedPositionsToRestore = savedInstanceState.getIntArray(SELECTION_VALUES_TAG); }/* ww w . j a v a 2 s . co m*/ }
From source file:com.styleme.floating.toolbox.pro.widget.colorpicker.dashclockpicker.ColorPickerDialogDash.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); View rootView = layoutInflater.inflate(R.layout.dash_dialog_colors, null); if (getArguments() != null) { mTitleResId = getArguments().getInt(KEY_TITLE_ID); mNumColumns = getArguments().getInt(KEY_COLUMNS); }/*from www . j a va2 s . c om*/ if (savedInstanceState != null) { mColorChoices = savedInstanceState.getIntArray(KEY_COLORS); mSelectedColor = (Integer) savedInstanceState.getSerializable(KEY_SELECTED_COLOR); tryBindLists(); } mColorGrid = (GridView) rootView.findViewById(R.id.color_grid); mColorGrid.setNumColumns(mNumColumns); mColorGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> listView, View view, int position, long itemId) { //Added //Toast.makeText(getActivity(), "Selected color="+mAdapter.getItem(position), Toast.LENGTH_LONG).show(); if (mListener != null) mListener.onColorSelected(mAdapter.getItem(position)); dismiss(); } }); tryBindLists(); if (AppHelper.isDarkTheme(getContext())) { return new AlertDialog.Builder(getActivity(), R.style.CustomDialogTheme).setView(rootView) .setTitle(mTitleResId) //Added .create(); } else { return new AlertDialog.Builder(getActivity()).setView(rootView).setTitle(mTitleResId) //Added .create(); } }