List of usage examples for android.os Bundle putStringArray
public void putStringArray(@Nullable String key, @Nullable String[] value)
From source file:Main.java
@SuppressWarnings("unchecked") private static void putArray(String key, ArrayList arrayList, Bundle bundle) { if (arrayList.size() == 0) { bundle.putBooleanArray(key, new boolean[] {}); } else {//from ww w . j ava 2 s. c o m verifyArrayListIsSingleType(arrayList); if (arrayList.get(0) instanceof String) { bundle.putStringArray(key, toStringArray((ArrayList<String>) arrayList)); } else if (arrayList.get(0) instanceof Integer) { bundle.putIntArray(key, toIntArray((ArrayList<Integer>) arrayList)); } else if (arrayList.get(0) instanceof Float) { bundle.putFloatArray(key, toFloatArray((ArrayList<Float>) arrayList)); } else if (arrayList.get(0) instanceof Double) { bundle.putDoubleArray(key, toDoubleArray((ArrayList<Double>) arrayList)); } else if (arrayList.get(0) instanceof Boolean) { bundle.putBooleanArray(key, toBooleanArray((ArrayList<Boolean>) arrayList)); } else if (arrayList.get(0) instanceof HashMap) { bundle.putParcelableArray(key, toBundleArray((ArrayList<HashMap>) arrayList)); } else if (arrayList.get(0) instanceof ArrayList) { Log.w("RNNavigation", "Arrays of arrays passed in props are converted to dictionaries with indexes as keys"); Bundle innerArray = new Bundle(); for (int i = 0; i < arrayList.size(); i++) { putArray(String.valueOf(i), (ArrayList) arrayList.get(i), innerArray); } bundle.putParcelable(key, innerArray); } } }
From source file:org.dmfs.webcal.fragments.GenericListFragment.java
public static GenericListFragment newInstance(Uri uri, String title, int emptyMessage, String[] projection, boolean showStars) { GenericListFragment result = new GenericListFragment(); Bundle args = new Bundle(); args.putParcelable(ARG_URI, uri); args.putString(ARG_TITLE, title);//from ww w . jav a 2s.co m args.putInt(ARG_EMPTY_MESSAGE, emptyMessage); args.putStringArray(ARG_PROJECTION, projection); args.putBoolean(ARG_SHOW_STARS, showStars); result.setArguments(args); return result; }
From source file:csci310.parkhere.ui.fragments.PublicProfileFragment.java
/** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1.// w w w . j ava 2s . c o m * @param param2 Parameter 2. * @return A new instance of fragment PublicProfileFragment. */ // TODO: Rename and change types and number of parameters public static PublicProfileFragment newInstance(String param1, String param2, String param3, String[] param4) { PublicProfileFragment fragment = new PublicProfileFragment(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); args.putString(ARG_PARAM3, param3); args.putStringArray(ARG_PARAM4, param4); fragment.setArguments(args); return fragment; }
From source file:com.bydavy.card.receipts.fragments.ReceiptPagerFragment.java
public static ReceiptPagerFragment newInstance(int pageIndex, String selection, String[] selectionArgs, String sortOrder) {/* w ww . j a va2s. c o m*/ final ReceiptPagerFragment f = new ReceiptPagerFragment(); final Bundle args = new Bundle(); args.putInt(ARG_PAGE_INDEX, pageIndex); args.putString(ARG_SELECTION, selection); args.putStringArray(ARG_SELECTION_ARGS, selectionArgs); args.putString(ARG_SORTORDER, sortOrder); f.setArguments(args); return f; }
From source file:uk.org.rivernile.edinburghbustracker.android.fragments.general.AddTimeAlertFragment.java
/** * Create a new instance of the AddTimeAlertFragment. * //ww w .j av a 2 s . c o m * @param stopCode The stopCode this alert setting should be for. * @param defaultServices The default services to show. * @return A new instance of this Fragment. */ public static AddTimeAlertFragment newInstance(final String stopCode, final String[] defaultServices) { final AddTimeAlertFragment f = new AddTimeAlertFragment(); final Bundle b = new Bundle(); b.putString(ARG_STOPCODE, stopCode); b.putStringArray(ARG_DEFAULT_SERVICES, defaultServices); f.setArguments(b); return f; }
From source file:com.bydavy.card.receipts.fragments.ReceiptListFragment.java
public static ReceiptListFragment newInstance(String selection, String[] selectionArgs, String sortOrder) { final ReceiptListFragment f = new ReceiptListFragment(); final Bundle args = new Bundle(); args.putString(ARG_SELECTION, selection); args.putStringArray(ARG_SELECTION_ARGS, selectionArgs); args.putString(ARG_SORTORDER, sortOrder); f.setArguments(args);/*from ww w .j a v a 2 s. co m*/ return f; }
From source file:com.tobolkac.triviaapp.ScreenSlidePageFragment.java
/** * Factory method for this fragment class. Constructs a new fragment for the given page number. *///from w w w . j a va2 s . c o m public static ScreenSlidePageFragment create(int pageNumber, String cat, ParseObject q) { //query to get question for the page //ParseQuery<ParseObject> queryQuestion = ParseQuery.getQuery("Questions"); //Log.d("page number query", "question num: " +cat ); //queryQuestion.whereEqualTo("category", cat); //queryQuestion.whereEqualTo("categoryIndex", pageNumber+1);//questionsNumArray[pageNumber]); Log.d("question in Fragment", "number: " + q.getInt("categoryIndex")); ParseObject question = q; //ac.getQuestion(pageNumber); /*try { question = queryQuestion.getFirst(); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); }*/ String[] answers = new String[4]; for (int i = 0; i < 4; i++) { answers[i] = question.getString("answer" + (i + 1)); } if (pageNumber == 0) { numCorrect = 0; } ScreenSlidePageFragment fragment = new ScreenSlidePageFragment(); Bundle args = new Bundle(); args.putInt(ARG_PAGE, pageNumber); args.putString("question", question.getString("question").toString()); args.putStringArray("answers", answers); args.putInt("answerCorrect", question.getNumber("answerCorrect").intValue()); fragment.setArguments(args); return fragment; }
From source file:com.emacs.xpets.utils.Utils.java
public static Bundle extractPropertiesIntoBundle(List<Pet> pets) { Bundle bundle = new Bundle(); int i = 0;// ww w .j av a2 s . c om String[] titles = new String[pets.size()]; String[] images = new String[pets.size()]; String[] keys = new String[pets.size()]; for (Pet p : pets) { titles[i] = p.getTitle(); images[i] = p.getPhoto(); keys[i] = p.getKey(); i++; } bundle.putStringArray("keys", keys); bundle.putStringArray("titles", titles); bundle.putStringArray("images", images); return bundle; }
From source file:felixwiemuth.lincal.ui.HtmlDialogFragment.java
private static void addActionsToBundle(Bundle bundle, Class<? extends Action>[] actions) { String[] actionNames = new String[actions.length]; for (int i = 0; i < actionNames.length; i++) { actionNames[i] = actions[i].getCanonicalName(); }/*from w w w .j a v a 2s . c o m*/ bundle.putStringArray(ARG_ACTIONS, actionNames); }
From source file:de.aw.monma.wertpapier.FragmentWertpapierBuchungenListe.java
/** * Erstellt eine neues FragmentWertpapierbuchungen. Es duerfen nicht beide Parameter * gleichzeitig null sein.//from w w w .j a v a2s .co m * * @param accountID * accountID, * @param wpID * wpID * @param wpName * wpName - kann null sein, wenn wpid = NOID * * @return Fragment */ public static FragmentWertpapierBuchungenListe newInstance(Integer accountID, Long wpID, String wpName) { if (accountID == null) { accountID = NOID; } if (wpID == null) { wpID = (long) NOID; } FragmentWertpapierBuchungenListe f = new FragmentWertpapierBuchungenListe(); String selection = column_partnername + " LIKE ? AND "; String[] selectionArgs = null; String title = null; if (wpID == NOID & accountID == NOID) { throw new IllegalStateException("WPID und ACCOUNTID sind Null!"); } if (wpID != NOID & accountID == NOID) { selection = wpIDSselection; selectionArgs = new String[] { String.valueOf(wpID) }; title = wpName; } if (wpID == NOID & accountID != NOID) { selection += accountIDSselection; selectionArgs = new String[] { "%%", String.valueOf(accountID) }; title = Account.getAccountName(accountID); } if (wpID != NOID & accountID != NOID) { selection = wpIDSselection + " AND " + accountIDSselection; selectionArgs = new String[] { String.valueOf(wpID), String.valueOf(accountID) }; title = Account.getAccountName(accountID) + " / " + wpName; } Bundle args = new Bundle(); args.putInt(ACCOUNTID, accountID); args.putLong(WPID, wpID); args.putString(WPNAME, wpName); args.putString(SELECTION, selection); args.putStringArray(SELECTIONARGS, selectionArgs); args.putString(TITLE, title); f.setArguments(args); return f; }