List of usage examples for android.os Bundle getStringArray
@Nullable
public String[] getStringArray(@Nullable String key)
From source file:com.android.contacts.list.ContactEntryListAdapter.java
/** * Updates the indexer, which is used to produce section headers. *///w w w. jav a 2 s . co m //private void updateIndexer(Cursor cursor) { public void updateIndexer(Cursor cursor) { if (cursor == null) { setIndexer(null); return; } Bundle bundle = cursor.getExtras(); if (bundle.containsKey(ContactCounts.EXTRA_ADDRESS_BOOK_INDEX_TITLES)) { String sections[] = bundle.getStringArray(ContactCounts.EXTRA_ADDRESS_BOOK_INDEX_TITLES); int counts[] = bundle.getIntArray(ContactCounts.EXTRA_ADDRESS_BOOK_INDEX_COUNTS); setIndexer(new ContactsSectionIndexer(sections, counts)); } else { setIndexer(null); } }
From source file:com.conferenceengineer.android.iosched.ui.ScheduleFragment.java
private void loadActionModeState(Bundle state) { if (state != null && state.containsKey(STATE_ACTION_MODE)) { mActionModeStarted = true;/*w ww .j av a 2s.c om*/ mActionMode = ((ActionBarActivity) getActivity()).startSupportActionMode(this); String[] data = state.getStringArray(STATE_ACTION_MODE); if (data != null) { mSelectedItemData = new SparseArray<String>(); mSelectedItemData.put(BlocksQuery.STARRED_SESSION_ID, data[0]); mSelectedItemData.put(BlocksQuery.STARRED_SESSION_TITLE, data[1]); mSelectedItemData.put(BlocksQuery.STARRED_SESSION_HASHTAGS, data[2]); mSelectedItemData.put(BlocksQuery.STARRED_SESSION_URL, data[3]); mSelectedItemData.put(BlocksQuery.STARRED_SESSION_ROOM_ID, data[4]); } } }
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); }/*w w w .ja v a 2s . 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:com.example.android.movies.app.SearchFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Add this line in order for this fragment to handle menu events. setHasOptionsMenu(true);/*from w ww .j a v a 2s . c om*/ Bundle arguments = this.getArguments(); if (arguments != null) { busqueda = arguments.getString("search"); } if (savedInstanceState != null) { // Restore value of members from saved state //busqueda = savedInstanceState.getString("busqueda"); titles = savedInstanceState.getStringArray("titles"); years = savedInstanceState.getStringArray("years"); resultIDs = savedInstanceState.getStringArray("ids"); } }
From source file:com.greendev.image.ImageGridActivity.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy);/*from www.ja v a2 s . com*/ /* * get the intent called from an Activity (eg. Portfolio.class or * PhotoActivity) */ Intent intent = getIntent(); /** get the bundle from the intent **/ Bundle b = intent.getExtras(); // set title in action bar TITLE = b.getString("TITLE"); setActionBarTitle(TITLE); // PhotoActivityGridFragment key = b.getString("key"); if (key == null) key = "hi"; if (BuildConfig.DEBUG) { Utils.enableStrictMode(); } try { if (getSupportFragmentManager().findFragmentByTag(TAG) == null) { final FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); // If calling this activity for the Gallery images then use // PhotoActivityGridFragment if (key.equals("PhotoActivityGridFragment")) { TYPE_URL_THUMB = b.getStringArray("TYPE_URL_THUMB"); SETS_NAMES = b.getStringArray("SETS_NAMES"); /* Parcelable Objects from PhotoActivity */ setImgsParcel = b.getParcelable("SET_IMGS"); if (setImgsParcel != null) { setImgs = setImgsParcel.getArray(); if (setImgs == null) setImgs = Images.boothDesignsThumbUrls; } else setImgs = Images.campaignsThumbUrls; setThumbsParcel = b.getParcelable("SET_THUMBS"); if (setThumbsParcel != null) { setThumbs = setThumbsParcel.getArray(); if (setThumbs == null) setThumbs = Images.boothDesignsThumbUrls; } else setThumbs = Images.campaignsThumbUrls; setDescsParcel = b.getParcelable("SET_DESCS"); if (setDescsParcel != null) { setDescs = setDescsParcel.getArray(); if (setDescs == null) setDescs = Images.boothDesignsThumbUrls; } else setDescs = Images.campaignsThumbUrls; ft.add(android.R.id.content, new PhotoActivityGridFragment(this, ImageGridActivity.class, TYPE_URL_THUMB, setImgs, setThumbs, setDescs, SETS_NAMES), TAG); } else { /** retrieve the string array extra passed */ TYPE_URL = b.getStringArray("TYPE_URL"); TYPE_URL_THUMB = b.getStringArray("TYPE_URL_THUMB"); CAPTIONS = b.getStringArray("CAPTIONS"); ft.add(android.R.id.content, new ImageGridFragment(this, ImageDetailActivity.class, TYPE_URL, TYPE_URL_THUMB, CAPTIONS), TAG); } ft.commit(); } } catch (Exception e) { Log.e(TAG, e.toString()); } }
From source file:li.barter.fragments.dialogs.AlertDialogFragment.java
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { if (savedInstanceState != null) { mTitleId = savedInstanceState.getInt(DialogKeys.TITLE_ID); mMessageId = savedInstanceState.getInt(DialogKeys.MESSAGE_ID); mNegativeLabelId = savedInstanceState.getInt(DialogKeys.NEGATIVE_LABEL_ID); mNeutralLabelId = savedInstanceState.getInt(DialogKeys.NEUTRAL_LABEL_ID); mPositiveLabelId = savedInstanceState.getInt(DialogKeys.POSITIVE_LABEL_ID); isCancellable = savedInstanceState.getBoolean(DialogKeys.CANCELLABLE); mIconId = savedInstanceState.getInt(DialogKeys.ICON_ID); mTheme = savedInstanceState.getInt(DialogKeys.THEME); mMessageParams = savedInstanceState.getStringArray(DialogKeys.MESSAGE_PARAMS); }//from ww w. j a v a2s . c o m final Builder builder = new Builder(getActivity(), mTheme); if ((mTitleId == 0) && (mMessageId == 0)) { throw new IllegalArgumentException("No Title and no message"); } if (mIconId != 0) { builder.setIcon(mIconId); } if (mTitleId != 0) { builder.setTitle(mTitleId); } if (mMessageId != 0) { if ((mMessageParams != null) && (mMessageParams.length > 0)) { builder.setMessage(getActivity().getString(mMessageId, (Object[]) mMessageParams)); } else { builder.setMessage(mMessageId); } } if (mPositiveLabelId != 0) { builder.setPositiveButton(mPositiveLabelId, mClickListener); } if (mNegativeLabelId != 0) { builder.setNegativeButton(mNegativeLabelId, mClickListener); } if (mNeutralLabelId != 0) { builder.setNeutralButton(mNeutralLabelId, mClickListener); } builder.setCancelable(isCancellable); setCancelable(isCancellable); return builder.create(); }
From source file:fr.cph.chicago.core.activity.BusMapActivity.java
@Override public final void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); App.checkBusData(this); if (!this.isFinishing()) { MapsInitializer.initialize(getApplicationContext()); setContentView(R.layout.activity_map); ButterKnife.bind(this); if (savedInstanceState != null) { busId = savedInstanceState.getInt(bundleBusId); busRouteId = savedInstanceState.getString(bundleBusRouteId); bounds = savedInstanceState.getStringArray(bundleBusBounds); } else {/*from w w w. j a v a 2s. c om*/ final Bundle extras = getIntent().getExtras(); busId = extras.getInt(bundleBusId); busRouteId = extras.getString(bundleBusRouteId); bounds = extras.getStringArray(bundleBusBounds); } busMarkers = new ArrayList<>(); busStationMarkers = new ArrayList<>(); views = new HashMap<>(); status = new HashMap<>(); busListener = new BusMapOnCameraChangeListener(getApplicationContext()); setToolbar(); Util.trackScreen(getApplicationContext(), analyticsBusMap); } }
From source file:li.barter.fragments.dialogs.EnableLocationDialogFragment.java
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { if (savedInstanceState != null) { mTitleId = savedInstanceState.getInt(DialogKeys.TITLE_ID); mMessageId = savedInstanceState.getInt(DialogKeys.MESSAGE_ID); mNegativeLabelId = savedInstanceState.getInt(DialogKeys.NEGATIVE_LABEL_ID); mNeutralLabelId = savedInstanceState.getInt(DialogKeys.NEUTRAL_LABEL_ID); mPositiveLabelId = savedInstanceState.getInt(DialogKeys.POSITIVE_LABEL_ID); isCancellable = savedInstanceState.getBoolean(DialogKeys.CANCELLABLE); mIconId = savedInstanceState.getInt(DialogKeys.ICON_ID); mTheme = savedInstanceState.getInt(DialogKeys.THEME); mMessageParams = savedInstanceState.getStringArray(DialogKeys.MESSAGE_PARAMS); }/* w w w . ja va2s .co m*/ final Builder builder = new Builder(getActivity(), mTheme); if ((mTitleId == 0) && (mMessageId == 0)) { throw new IllegalArgumentException("No Title and no message"); } if (mMessageId != 0) { if ((mMessageParams != null) && (mMessageParams.length > 0)) { builder.setMessage(getActivity().getString(mMessageId, (Object[]) mMessageParams)); } else { builder.setMessage(mMessageId); } } if (mIconId != 0) { builder.setIcon(mIconId); } if (mTitleId != 0) { builder.setTitle(mTitleId); } if (mPositiveLabelId != 0) { builder.setPositiveButton(mPositiveLabelId, mClickListener); } if (mNegativeLabelId != 0) { builder.setNegativeButton(mNegativeLabelId, mClickListener); } if (mNeutralLabelId != 0) { builder.setNeutralButton(mNeutralLabelId, mClickListener); } builder.setCancelable(isCancellable); setCancelable(isCancellable); return builder.create(); }
From source file:org.eatabrick.vecna.Vecna.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);//w w w. ja v a2 s . c o m settings = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); adapter = new PasswordEntryAdapter(this); adapter.setNotifyOnChange(false); setListAdapter(adapter); Security.addProvider(new BouncyCastleProvider()); if (savedInstanceState != null) { passphrase = savedInstanceState.getString("passphrase"); adapter.populate(savedInstanceState.getStringArray("entries")); adapter.notifyDataSetChanged(); } getListView().setLongClickable(true); getListView().setOnItemLongClickListener(new OnItemLongClickListener() { public boolean onItemLongClick(AdapterView<?> parent, View v, int pos, long id) { onListItemLongClick(parent, v, pos, id); return true; } }); }
From source file:net.reichholf.dreamdroid.fragment.MovieListFragment.java
@Override public void onCreate(Bundle savedInstanceState) { mCardListStyle = true;//from ww w. j a v a 2s. c o m mEnableReload = true; super.onCreate(savedInstanceState); initTitle(getString(R.string.movies)); mCurrentLocation = "/hdd/movie/"; mSelectedLocationPosition = 0; if (savedInstanceState == null) { mSelectedTags = new ArrayList<String>(); mOldTags = new ArrayList<String>(); mReload = true; } else { mMovie = (ExtendedHashMap) savedInstanceState.getParcelable("movie"); mSelectedTags = new ArrayList<String>(Arrays.asList(savedInstanceState.getStringArray("selectedTags"))); mOldTags = new ArrayList<String>(Arrays.asList(savedInstanceState.getStringArray("oldTags"))); mCurrentLocation = savedInstanceState.getString("currentLocation"); mSelectedLocationPosition = savedInstanceState.getInt("selectedLocationPosition", 0); } }