List of usage examples for android.os Bundle getStringArray
@Nullable
public String[] getStringArray(@Nullable String key)
From source file:com.dm.material.dashboard.candybar.fragments.dialog.InAppBillingFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (savedInstanceState != null) { mType = savedInstanceState.getInt(TYPE); mKey = savedInstanceState.getString(KEY); mProductsId = savedInstanceState.getStringArray(PRODUCT_ID); mProductsCount = savedInstanceState.getIntArray(PRODUCT_COUNT); }//w w w .j a va 2 s . c o m loadInAppProducts(); }
From source file:net.potterpcs.recipebook.IngredientsEditor.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { activity = (RecipeEditor) getActivity(); ingredients = new ArrayList<String>(); currentIngredient = -1;/*from w ww.j a v a 2 s. co m*/ // Check for saved state and load it if needed if (savedInstanceState != null) { String[] saved = savedInstanceState.getStringArray(STATE); if (saved != null) { ingredients.addAll(Arrays.asList(saved)); } } else { // No saved state, so we start a fresh editor long rid = activity.getRecipeId(); // Log.i(TAG, "id=" + rid); // If we're editing an existing recipe... if (rid > 0) { RecipeBook app = (RecipeBook) activity.getApplication(); Cursor c = app.getData().getRecipeIngredients(rid); // Log.i(TAG, "count=" + c.getCount()); c.moveToFirst(); while (!c.isAfterLast()) { // Log.i(TAG, c.getString(c.getColumnIndex(RecipeData.IT_NAME))); ingredients.add(c.getString(c.getColumnIndex(RecipeData.IT_NAME))); c.moveToNext(); } c.close(); } else { // We're creating a new recipe, so no setup required (yet?) } } adapter = new ArrayAdapter<String>(activity, android.R.layout.simple_list_item_1, ingredients); return inflater.inflate(R.layout.ingredientsedit, container, false); }
From source file:com.brodev.socialapp.view.ImagePagerActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); ColorDrawable color = new ColorDrawable(Color.TRANSPARENT); color.setAlpha(128);//from www . ja va 2 s. c om getSupportActionBar().setBackgroundDrawable(color); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setContentView(R.layout.ac_image_pager); File cacheDir = new File(this.getCacheDir(), "imgcachedir"); if (!cacheDir.exists()) cacheDir.mkdir(); // phrase manager phraseManager = new PhraseManager(getApplicationContext()); Bundle bundle = getIntent().getExtras(); String[] imageUrls = bundle.getStringArray("image"); String[] imagesId = bundle.getStringArray("photo_id"); String[] HasLike = bundle.getStringArray("HasLike"); String[] FeedisLike = bundle.getStringArray("FeedisLike"); String[] Total_like = bundle.getStringArray("Total_like"); String[] Total_comment = bundle.getStringArray("Total_comment"); String[] Itemid = bundle.getStringArray("Itemid"); String[] Type = bundle.getStringArray("Type"); int pagerPosition = bundle.getInt("position", 0); if (savedInstanceState != null) { pagerPosition = savedInstanceState.getInt(STATE_POSITION); } pager = (ViewPager) findViewById(R.id.pager); pager.setAdapter(new ImagePagerAdapter(this, imageUrls, imagesId, HasLike, FeedisLike, Total_like, Total_comment, Itemid, Type)); pager.setOffscreenPageLimit(2); pager.setCurrentItem(pagerPosition); this.getWindow().setBackgroundDrawableResource(android.R.color.transparent); }
From source file:info.wncwaterfalls.app.InformationMapFragment.java
@Override public Loader<Cursor> onCreateLoader(int loaderId, Bundle args) { // Get the query from our parent activity and pass it to the loader, which will execute it switch (loaderId) { case InformationMapFragment.WATERFALL_QUERY_LOADER: Bundle qBundle = sQueryListener.onWaterfallQuery(); cursorLoader = new SQLiteCursorLoader(getActivity(), mAttrDb, qBundle.getString("query"), qBundle.getStringArray("args")); break;//w ww. j a v a2 s . com } return cursorLoader; }
From source file:info.wncwaterfalls.app.InformationListFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { Bundle qBundle = sQueryListener.onWaterfallQuery(); // Get the query from our parent activity and pass it to the loader, which will execute it cursorLoader = new SQLiteCursorLoader(getActivity(), mDb, qBundle.getString("query"), qBundle.getStringArray("args")); return cursorLoader; }
From source file:org.dmfs.tasks.SettingsListFragment.java
/** * The SQL selection condition used to select synced or visible list, the parameters for the select condition, the layout to be used and the column which is * used for current selection is passed through a {@link Bundle}. The fragment layout is inflated and returned. */// w w w . jav a2s .c om @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Bundle args = getArguments(); mListSelectionArguments = args.getString(LIST_SELECTION_ARGS); mListSelectionParam = args.getStringArray(LIST_STRING_PARAMS); mFragmentLayout = args.getInt(LIST_FRAGMENT_LAYOUT); mSaveOnPause = args.getBoolean(LIST_ONDETACH_SAVE); mListCompareColumnName = args.getString(COMPARE_COLUMN_NAME); View view = inflater.inflate(mFragmentLayout, container, false); return view; }
From source file:fr.cph.chicago.core.activity.BusMapActivity.java
@Override public void onRestoreInstanceState(final Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); busId = savedInstanceState.getInt(bundleBusId); busRouteId = savedInstanceState.getString(bundleBusRouteId); bounds = savedInstanceState.getStringArray(bundleBusBounds); }
From source file:eu.trentorise.smartcampus.eb.fragments.experience.AssignCollectionFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { final List<ExpCollection> collections = EBHelper.getUserPreference().getCollections(); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.expmenu_assign_collection); if (savedInstanceState != null) { selected = savedInstanceState.getBooleanArray("selected"); selectedIds = new HashSet<String>(savedInstanceState.getStringArrayList("selectedIds")); items = savedInstanceState.getStringArray("items"); } else {// www. j av a2s. com items = new String[collections.size()]; selected = new boolean[collections.size()]; for (int i = 0; i < items.length; i++) { items[i] = collections.get(i).getName(); boolean b = false; if (getArguments().getStringArrayList(ARG_COLLS) != null) { for (String s : getArguments().getStringArrayList(ARG_COLLS)) { if (s.equals(collections.get(i).getId())) { b = true; break; } } } selected[i] = b; } selectedIds = new HashSet<String>(); if (getArguments().getStringArrayList(ARG_COLLS) != null) selectedIds.addAll(getArguments().getStringArrayList(ARG_COLLS)); } builder.setMultiChoiceItems(items, selected, new OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int which, boolean isChecked) { if (isChecked) selectedIds.add(collections.get(which).getId()); else selectedIds.remove(collections.get(which).getId()); } }); builder.setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // exp.setCollectionIds(new ArrayList<String>(selectedIds)); // Fragment f = getFragmentManager().findFragmentById(containerId); AssignCollectionsCallback c = ((DialogCallbackContainer) getActivity()) .getAssignCollectionsCallback(); c.onCollectionsAssigned(getArguments().getString(ARG_ID), new ArrayList<String>(selectedIds)); dialog.dismiss(); } }); builder.setPositiveButton(R.string.dialog_collection_add, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { DialogFragment newCollFragment = new NewCollectionDialogFragment(); newCollFragment.setArguments(NewCollectionDialogFragment.prepare(null)); newCollFragment.show(getActivity().getSupportFragmentManager(), "exp_coll"); // // NewCollectionDialogFragment.saveCollectionDialog(getActivity(), null, new CollectionSavedHandler() { // @Override // public void onCollectionSaved(ExpCollection coll) { //// exp.setCollectionIds(Collections.singletonList(coll.getId())); // ((AssignCollectionsCallback)getFragmentManager().findFragmentById(android.R.id.content)).onCollectionsAssigned(getArguments().getString(ARG_ID), Collections.singletonList(coll.getId())); // } // }).show(); dialog.dismiss(); } }); return builder.create(); }
From source file:ca.rmen.android.poetassistant.main.MainActivity.java
@Override public void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); // If the user cleared search history and rotated the device before the snackbar // disappeared, let's show the snackbar again to let them undo. if (savedInstanceState.containsKey(EXTRA_CLEARED_HISTORY)) { String[] clearedHistory = savedInstanceState.getStringArray(EXTRA_CLEARED_HISTORY); mClearedHistory = clearedHistory; showClearHistorySnackbar(clearedHistory); }//from w w w . j a v a 2 s. co m }
From source file:com.ademsha.appnotifico.NotificationDataHelper.java
@TargetApi(Build.VERSION_CODES.KITKAT) private static JSONObject getNotificationExtras(JSONObject notification, StatusBarNotification statusBarNotification) { try {/*from w w w.j ava 2 s. c om*/ Bundle extras = statusBarNotification.getNotification().extras; if (extras != null) { notification.put("text", extras.getString(Notification.EXTRA_TEXT)); notification.put("sub_text", extras.getString(Notification.EXTRA_SUB_TEXT)); notification.put("summary_text", extras.getString(Notification.EXTRA_SUMMARY_TEXT)); notification.put("text_lines", Arrays .toString(extras.getCharSequenceArray(Notification.EXTRA_TEXT_LINES)).replace("null", "")); notification.put("icon", String.valueOf(extras.getInt(Notification.EXTRA_SMALL_ICON))); if (extras.getParcelable(Notification.EXTRA_LARGE_ICON) != null) { notification.put("large_icon", String.valueOf(extras.getParcelable(Notification.EXTRA_LARGE_ICON).toString()) .replace("null", "")); } notification.put("title", extras.getString(Notification.EXTRA_TITLE)); notification.put("title_big", extras.getString(Notification.EXTRA_TITLE_BIG)); notification.put("progress", extras.getInt(Notification.EXTRA_PROGRESS)); notification.put("progress_indeterminate", String.valueOf(extras.getBoolean(Notification.EXTRA_PROGRESS_INDETERMINATE))); notification.put("progress_max", String.valueOf(extras.getInt(Notification.EXTRA_PROGRESS_MAX))); notification.put("people", extras.getStringArray(Notification.EXTRA_PEOPLE)); } } catch (JSONException e) { e.printStackTrace(); } return notification; }