Example usage for android.os Bundle putStringArray

List of usage examples for android.os Bundle putStringArray

Introduction

In this page you can find the example usage for android.os Bundle putStringArray.

Prototype

public void putStringArray(@Nullable String key, @Nullable String[] value) 

Source Link

Document

Inserts a String array value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:li.barter.fragments.dialogs.AlertDialogFragment.java

@Override
public void onSaveInstanceState(final Bundle outState) {

    outState.putInt(DialogKeys.TITLE_ID, mTitleId);
    outState.putInt(DialogKeys.NEGATIVE_LABEL_ID, mNegativeLabelId);
    outState.putInt(DialogKeys.POSITIVE_LABEL_ID, mPositiveLabelId);
    outState.putInt(DialogKeys.NEUTRAL_LABEL_ID, mNeutralLabelId);
    outState.putBoolean(DialogKeys.CANCELLABLE, isCancellable);
    outState.putInt(DialogKeys.ICON_ID, mIconId);
    outState.putInt(DialogKeys.THEME, mTheme);
    outState.putStringArray(DialogKeys.MESSAGE_PARAMS, mMessageParams);
    outState.putInt(DialogKeys.MESSAGE_ID, mMessageId);
    super.onSaveInstanceState(outState);
}

From source file:com.fbbackup.MyFriendFragmentActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (BuildConfig.DEBUG) {
        Utils.enableStrictMode();// w w  w .  j a  v  a  2 s.co m
    }
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.user_photo_layout);

    mContext = this;

    //  adView
    adView = new AdView(this, AdSize.BANNER, "a151aa20ff8c2a2");

    //      /*  */
    //      AdRequest adRequest = new AdRequest();
    //      adRequest.addTestDevice(AdRequest.TEST_EMULATOR); // u
    //      adRequest.addTestDevice("TEST_DEVICE_ID"); //  Android m
    //      /*  */
    friendsPicture = getIntent().getExtras().getStringArray("friendPic");

    friendsName = getIntent().getExtras().getStringArray("friendName");

    friendsID = getIntent().getExtras().getStringArray("friendID");

    tagMePicture = getIntent().getExtras().getStringArray("tagMePicture");

    token = getIntent().getExtras().getString("token");

    Fragment newFragment = new MyFriendFragment();

    Bundle args = new Bundle();
    args.putStringArray("friendPic", friendsPicture);
    args.putStringArray("friendName", friendsName);
    args.putStringArray("friendID", friendsID);
    args.putString("token", token);

    newFragment.setArguments(args);

    if (getSupportFragmentManager().getBackStackEntryCount() == 0) {
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.add(R.id.rl_user_photo, newFragment, "friend");
        //ft.replace(R.id.rl_user_photo, newFragment, "first");
        ft.addToBackStack(null);
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);

        ft.commit();
    }
    setView();
    setLisetner();

    // new download taskAappeu@tddownload task
    downloadTask = new DownloadTask();

    downloadTaskNoUI = new DownloadTaskNoUpdateUI();
}

From source file:com.google.android.apps.muzei.api.internal.SourceState.java

public Bundle toBundle() {
    Bundle bundle = new Bundle();
    if (mCurrentArtwork != null) {
        bundle.putBundle("currentArtwork", mCurrentArtwork.toBundle());
    }/*from  w  w w .jav  a  2s .  c o  m*/
    bundle.putString("description", mDescription);
    bundle.putBoolean("wantsNetworkAvailable", mWantsNetworkAvailable);
    String[] commandsSerialized = new String[mUserCommands.size()];
    for (int i = 0; i < commandsSerialized.length; i++) {
        commandsSerialized[i] = mUserCommands.get(i).serialize();
    }
    bundle.putStringArray("userCommands", commandsSerialized);
    return bundle;
}

From source file:mobi.cangol.mobile.base.CustomFragmentManager.java

public void saveState(Bundle outState) {
    executePendingTransactions();/*from   w  w w  . jav a2 s  .  c  o  m*/
    final int stackSize = stack.size();
    String[] stackTags = new String[stackSize];

    int i = 0;
    for (String tag : stack.getTag()) {
        Log.i(STATE_TAG, "tag =" + tag);
        stackTags[i++] = tag;
    }

    outState.putStringArray(STATE_TAG, stackTags);
}

From source file:us.socialgoodworking.mocklocation.MockLocationActivity.java

private void showPlaybackRouteSelectDlg() {
    DialogFragment f = new SelectRouteDialog();
    Bundle b = new Bundle();
    b.putStringArray("routes", routeList.getRoutes());
    f.setArguments(b);//  w w  w . j  ava 2 s  . com
    f.show(getSupportFragmentManager(), "routes");
}

From source file:com.fbbackup.MyFriendFragmentActivity.java

/**
 * gback/*from www . ja va 2s  .  c om*/
 */
@Override
public void onBackPressed() {
    // TODO Auto-generated method stub
    super.onBackPressed();

    // pGfragmnet stackOq0AN?efragment
    if (getSupportFragmentManager().getBackStackEntryCount() == 1) {
        controlPanelHandler.sendEmptyMessage(SHOW_CONTROL_PANEL);
    } else if (getSupportFragmentManager().getBackStackEntryCount() == 0) {
        // MainActivity.exitHandler.sendEmptyMessage(0);

        AlertDialog.Builder alertDialog2 = new AlertDialog.Builder(MyFriendFragmentActivity.this);

        // Setting Dialog Title
        alertDialog2.setTitle(getString(R.string.exit_app_tittle));

        // Setting Dialog Message
        alertDialog2.setMessage(getString(R.string.exit_app_text));

        // Setting Icon to Dialog
        // alertDialog2.setIcon(R.drawable.delete);

        // Setting Positive "Yes" Btn
        alertDialog2.setPositiveButton("YES", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                // Write your code here to execute after dialog
                exit();
                System.exit(0);
            }
        });
        // Setting Negative "NO" Btn
        alertDialog2.setNegativeButton("NO", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                // Write your code here to execute after dialog

                Fragment newFragment = new MyFriendFragment();

                Bundle args = new Bundle();
                args.putStringArray("friendPic", friendsPicture);
                args.putStringArray("friendName", friendsName);
                args.putStringArray("friendID", friendsID);
                args.putString("token", token);

                newFragment.setArguments(args);

                FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
                ft.replace(R.id.rl_user_photo, newFragment, "first");

                ft.addToBackStack(null);

                ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);

                ft.commit();

                dialog.cancel();
            }
        });

        // Showing Alert Dialog
        alertDialog2.show();

    }
    Log.w("dow", "getSupportFragmentManager().getBackStackEntryCount():"
            + getSupportFragmentManager().getBackStackEntryCount());
    // press back popup alertdialog ask finish this app

}

From source file:com.philliphsu.bottomsheetpickers.date.PagingMonthAdapter.java

@Override
public Parcelable saveState() {
    Bundle state = null;
    final int size = mMonthYearTitles.size();
    if (size > 0) {
        state = new Bundle();
        String[] titles = new String[size];
        int[] positions = new int[size];
        for (int i = 0; i < size; i++) {
            titles[i] = mMonthYearTitles.valueAt(i);
            positions[i] = mMonthYearTitles.keyAt(i);
        }//  w  w w  .j  a  va 2 s.  com
        state.putStringArray(KEY_MONTH_YEAR_TITLES, titles);
        state.putIntArray(KEY_POSITIONS, positions);
    }
    return state;
}

From source file:de.unipassau.isl.evs.ssh.app.activity.EditUserDeviceFragment.java

/**
 * Gets called in {@link #onContainerConnected(Container)}.
 * Builds the view components that require the container.
 *//*from  w  w w.  j av a  2s  . c om*/
private void buildView() {
    device = ((UserDevice) getArguments().getSerializable(USER_DEVICE_ARGUMENT_FRAGMENT));

    TextView deviceName = ((TextView) getActivity().findViewById(R.id.userdevice_user_name));
    deviceName.setText(device.getName());

    TextView deviceID = ((TextView) getActivity().findViewById(R.id.userdevice_id_group));
    deviceID.setText(String.format(getResources().getString(R.string.with_id_is_in_group),
            device.getUserDeviceID().toShortString(), device.getInGroup()));

    Button editButton = (Button) getActivity().findViewById(R.id.userdevice_edit_button);
    editButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Bundle bundle = new Bundle();
            bundle.putSerializable(EDIT_USERDEVICE_DIALOG, device);
            String[] groups = listGroups();
            if (groups != null) {
                bundle.putStringArray(ALL_GROUPS_DIALOG, groups);
            }

            // check if user has permission to edit a group
            final AppMainActivity activity = (AppMainActivity) getActivity();
            if (activity != null && !activity.hasPermission(Permission.CHANGE_USER_NAME)) {
                showToast(R.string.you_can_not_edit_user_devices);
            } else if (activity != null && !activity.hasPermission(Permission.CHANGE_USER_GROUP)) {
                showToast(R.string.you_can_not_edit_user_devices);
            } else {
                showEditUserDeviceDialog(bundle);
            }
        }
    });

    userPermissionList = (ListView) getActivity().findViewById(R.id.listUserPermissionContainer);
    permissionListAdapter = new PermissionListAdapter();
    userPermissionList.setAdapter(permissionListAdapter);
}

From source file:info.wncwaterfalls.app.ResultsActivity.java

@Override
public Bundle onWaterfallQuery() {
    // Set up our query
    ArrayList<String> whereList = new ArrayList<String>(); // To hold chunks of the WHERE clause
    ArrayList<String> argList = new ArrayList<String>(); // To hold our args
    switch (mSearchMode) {
    // See which terms we're going to need to query           
    case SearchActivity.SEARCH_MODE_WATERFALL:
        whereList.add("name like ?");
        argList.add('%' + searchTerm.trim() + '%');
        break;//from  ww w. j av a2 s . c om

    case SearchActivity.SEARCH_MODE_HIKE:
        whereList.add("trail_length <= ?");
        argList.add(String.valueOf(searchTrailLength));

        whereList.add("trail_difficulty_num <= ?");
        argList.add(String.valueOf(searchTrailDifficulty));

        whereList.add("trail_climb_num <= ?");
        argList.add(String.valueOf(searchTrailClimb));

        break;

    case SearchActivity.SEARCH_MODE_LOCATION:
        if (mFoundOrigin) {
            // Mi -> M
            double rangeMeters = searchLocationDistance * 1609.34;

            // Calculate our bounding box
            Location pn = calculatePositionAtRange(mOriginLocation, rangeMeters, 0);
            Location pe = calculatePositionAtRange(mOriginLocation, rangeMeters, 90);
            Location ps = calculatePositionAtRange(mOriginLocation, rangeMeters, 180);
            Location pw = calculatePositionAtRange(mOriginLocation, rangeMeters, 270);

            // Greater than S latitude
            whereList.add("geo_lat > ?");
            argList.add(String.valueOf(ps.getLatitude()));

            // Less than N latitude
            whereList.add("geo_lat < ?");
            argList.add(String.valueOf(pn.getLatitude()));

            // Less than E longitude
            whereList.add("geo_lon < ?");
            argList.add(String.valueOf(pe.getLongitude()));

            // Greater than W longitude
            whereList.add("geo_lon > ?");
            argList.add(String.valueOf(pw.getLongitude()));
        } else {
            // Make sure no results are returned, and a toast should happen
            // on the map side notifying the user as such.
            whereList.add("_id = ?");
            argList.add("");
        }

        // Requester can filter results to actual radius using 
        // android.location.Location.distanceTo()
        break;
    }

    // Restrict to only shared falls if box checked
    if (searchOnlyShared != null && searchOnlyShared) {
        whereList.add("shared=1");
    }

    String tables = "waterfalls";

    // Select all
    String[] columns = AttrDatabase.COLUMNS.toArray(new String[AttrDatabase.COLUMNS.size()]);

    String and = " AND "; // To join our where clause
    String whereClause = TextUtils.join(and, whereList);

    String query = SQLiteQueryBuilder.buildQueryString(false, tables, columns, whereClause, null, null,
            "name ASC", null);

    Bundle qBundle = new Bundle();
    qBundle.putString("query", query);
    String[] args = argList.toArray(new String[argList.size()]);
    qBundle.putStringArray("args", args);
    return qBundle;
}

From source file:com.money.manager.ex.home.DashboardFragment.java

private void showChartIncomeVsExpensesCurrentMonth(Cursor cursor) {
    // move to first
    if (!cursor.moveToFirst())
        return;//from w  w w  .ja  v  a 2  s .  c  o m
    // arrays
    double[] incomes = new double[3];
    double[] expenses = new double[3];
    String[] titles = new String[3];

    // incomes and expenses
    incomes[1] = cursor.getDouble(cursor.getColumnIndex(IncomeVsExpenseReportEntity.Income));
    expenses[1] = Math.abs(cursor.getDouble(cursor.getColumnIndex(IncomeVsExpenseReportEntity.Expenses)));
    // titles
    int year = cursor.getInt(cursor.getColumnIndex(IncomeVsExpenseReportEntity.YEAR));
    int month = cursor.getInt(cursor.getColumnIndex(IncomeVsExpenseReportEntity.Month));

    // format month
    //        Calendar calendar = Calendar.getInstance();
    //        calendar.set(year, month - 1, 1);
    MmxDate dateTime = new MmxDate(year, month - 1, 1);
    // titles
    //        titles[1] = Integer.toString(year) + "-" + new SimpleDateFormat("MMM").format(calendar.getTime());
    titles[1] = Integer.toString(year) + "-" + dateTime.toString("MMM");

    // compose bundle for arguments
    Bundle args = new Bundle();
    args.putDoubleArray(IncomeVsExpensesChartFragment.KEY_EXPENSES_VALUES, expenses);
    args.putDoubleArray(IncomeVsExpensesChartFragment.KEY_INCOME_VALUES, incomes);
    args.putStringArray(IncomeVsExpensesChartFragment.KEY_XTITLES, titles);
    args.putString(IncomeVsExpensesChartFragment.KEY_TITLE,
            getString(R.string.income_vs_expenses_current_month));
    args.putBoolean(IncomeVsExpensesChartFragment.KEY_DISPLAY_AS_UP_ENABLED, false);

    // get fragment manager
    FragmentManager fragmentManager = getChildFragmentManager();
    if (fragmentManager != null) {
        IncomeVsExpensesChartFragment fragment;

        fragment = new IncomeVsExpensesChartFragment();
        fragment.setChartArguments(args);

        if (fragment.isVisible())
            fragment.onResume();

        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.linearLayoutScreen1, fragment,
                IncomeVsExpensesChartFragment.class.getSimpleName());

        fragmentTransaction.commit();
    }
}