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:org.bwgz.quotation.fragment.AuthorFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    Log.d(TAG, String.format("onCreateView - savedInstanceState: %s", savedInstanceState));

    View view = inflater.inflate(R.layout.author_fragment, container, false);

    viewHolder = new ViewHolder();
    viewHolder.author_name = (TextView) view.findViewById(R.id.author_name);
    viewHolder.author_image = (NetworkImageView) view.findViewById(R.id.author_image);
    viewHolder.author_description_citation_full = (TextView) view
            .findViewById(R.id.author_description_citation_full);
    viewHolder.author_description_short = (TextView) view.findViewById(R.id.author_description_short);
    viewHolder.author_description_full = (TextView) view.findViewById(R.id.author_description_full);
    viewHolder.author_notable_for = (TextView) view.findViewById(R.id.author_notable_for);
    viewHolder.author_description_layout = (LinearLayout) view.findViewById(R.id.author_description_layout);
    viewHolder.author_description_layout_short = (RelativeLayout) view
            .findViewById(R.id.author_description_layout_short);
    viewHolder.author_description_layout_full = (RelativeLayout) view
            .findViewById(R.id.author_description_layout_full);
    viewHolder.quotation_grid = (GridView) view.findViewById(R.id.quotations);

    viewHolder.author_description_citation_full.setMovementMethod(LinkMovementMethod.getInstance());

    viewHolder.author_description_layout.setOnClickListener(new ViewToggleOnClickListener(
            viewHolder.author_description_layout_short, viewHolder.author_description_layout_full));

    GridView gridView = viewHolder.quotation_grid;
    gridView.setOnItemClickListener(new GridViewOnItemClickListener(gridView));
    gridView.setAdapter(new LoadingAdapter());

    Bundle bundle = new Bundle();
    bundle.putParcelable(LOADER_BUNDLE_URI, Person.withAppendedId(getPick().getId()));
    bundle.putStringArray(LOADER_BUNDLE_PROJECTION,
            new String[] { Person.NAME, Person.DESCRIPTION, Person.NOTABLE_FOR, Person.IMAGE_ID,
                    Person.CITATION_PROVIDER, Person.CITATION_STATEMENT, Person.CITATION_URI,
                    BookmarkPerson.BOOKMARK_ID });
    authorLoaderId = initLoader(this, bundle);
    quotationLoaderId = initLoader(this, PersonQuotation.withAppendedId(getPick().getId()),
            QuotationQuery.PROJECTION, null, null, null);

    return view;/*from w  ww. ja v a 2s .  c o  m*/
}

From source file:de.tudarmstadt.dvs.myhealthassistant.myhealthhub.MyHealthHubGlassMainActivity.java

private void openSelectDeviceDialog(String sensorType) {
    BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    if (mBluetoothAdapter != null) {
        BluetoothDevice[] mAllBondedDevices = (BluetoothDevice[]) mBluetoothAdapter.getBondedDevices()
                .toArray(new BluetoothDevice[0]);

        int mDeviceIndex = 0;
        if (mAllBondedDevices.length > 0) {
            int deviceCount = mAllBondedDevices.length;
            String[] deviceNames = new String[deviceCount];
            int i = 0;
            for (BluetoothDevice device : mAllBondedDevices) {
                deviceNames[i++] = device.getName() + "|" + device.getAddress();
            }/*from  w  w w .  ja v a  2 s. c  o m*/
            DialogFragment deviceDialog = new SelectDeviceDialogFragment();
            Bundle args = new Bundle();
            args.putString("sensorType", sensorType);
            args.putStringArray("names", deviceNames);
            args.putInt("position", mDeviceIndex);
            args.putBoolean("device", true);
            deviceDialog.setArguments(args);
            getFragmentManager().beginTransaction();
            deviceDialog.show(getSupportFragmentManager().beginTransaction(), "deviceDialog");
        }
    }
}

From source file:com.example.android.movies.app.SearchFragment.java

@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
    savedInstanceState.putString("busqueda", busqueda);
    savedInstanceState.putStringArray("titles", titles);
    savedInstanceState.putStringArray("ids", resultIDs);
    savedInstanceState.putStringArray("years", years);

    // Always call the superclass so it can save the view hierarchy state
    super.onSaveInstanceState(savedInstanceState);
}

From source file:org.bwgz.quotation.fragment.QuotationFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    Log.d(TAG, String.format("onCreateView - savedInstanceState: %s", savedInstanceState));

    View view = inflater.inflate(R.layout.quotation_fragment, container, false);

    viewHolder = new ViewHolder();
    viewHolder.quotation_text = (TextView) view.findViewById(R.id.quotation_text);
    viewHolder.spoken_by_character = (TextView) view.findViewById(R.id.spoken_by_character);
    viewHolder.source = (TextView) view.findViewById(R.id.source);
    viewHolder.author_name = (TextView) view.findViewById(R.id.author_name);
    viewHolder.author_image = (NetworkImageView) view.findViewById(R.id.author_image);
    viewHolder.author_description_citation_full = (TextView) view
            .findViewById(R.id.author_description_citation_full);
    viewHolder.author_description_short = (TextView) view.findViewById(R.id.author_description_short);
    viewHolder.author_description_full = (TextView) view.findViewById(R.id.author_description_full);
    viewHolder.author_notable_for = (TextView) view.findViewById(R.id.author_notable_for);
    viewHolder.author_description_layout = (LinearLayout) view.findViewById(R.id.author_description_layout);
    viewHolder.author_description_layout_short = (RelativeLayout) view
            .findViewById(R.id.author_description_layout_short);
    viewHolder.author_description_layout_full = (RelativeLayout) view
            .findViewById(R.id.author_description_layout_full);

    viewHolder.author_description_citation_full.setMovementMethod(LinkMovementMethod.getInstance());

    viewHolder.author_description_layout.setOnClickListener(new ViewToggleOnClickListener(
            viewHolder.author_description_layout_short, viewHolder.author_description_layout_full));

    if (viewHolder.author_image != null) {
        viewHolder.author_image.setDefaultImageResId(R.drawable.pick_image_holder);
    }/*from   w w w.ja  v  a 2  s .c o  m*/

    Bundle bundle = new Bundle();
    bundle.putParcelable(LOADER_BUNDLE_URI, Quotation.withAppendedId(getPick().getId()));
    bundle.putStringArray(LOADER_BUNDLE_PROJECTION, new String[] { Quotation.QUOTATION,
            Quotation.SPOKEN_BY_CHARACTER, Source.NAME, Source.TYPE, BookmarkQuotation.BOOKMARK_ID });
    quotationLoaderId = initLoader(this, bundle);

    bundle = new Bundle();
    bundle.putParcelable(LOADER_BUNDLE_URI, QuotationPerson.withAppendedId(getPick().getId()));
    bundle.putStringArray(LOADER_BUNDLE_PROJECTION,
            new String[] { Person._ID, Person.NAME, Person.DESCRIPTION, Person.NOTABLE_FOR, Person.IMAGE_ID,
                    Person.CITATION_PROVIDER, Person.CITATION_STATEMENT, Person.CITATION_URI });
    authorLoaderId = initLoader(this, bundle);

    return view;
}

From source file:com.loloof64.android.chess_position_manager.MainActivity.java

@Override
public void onConfirmRemoveElementsDialogPositiveClick(String[] foldersNames, String[] positionsNames) {
    ArrayList<String> failedFolders = new ArrayList<>();
    ArrayList<String> failedPositions = new ArrayList<>();

    for (String currentFolderName : foldersNames) {
        if (!directoryManager.tryToRemoveFileOrFolder(currentFolderName)) {
            failedFolders.add(currentFolderName);
        }/*ww  w.j av  a  2 s .  c o  m*/
    }

    for (String currentPositionName : positionsNames) {
        if (!directoryManager.tryToRemoveFileOrFolder(currentPositionName)) {
            failedPositions.add(currentPositionName);
        }
    }

    boolean allSucceed = failedPositions.isEmpty() && failedFolders.isEmpty();
    if (!allSucceed) {
        Collections.sort(failedFolders);
        Collections.sort(failedPositions);

        String[] failedFoldersArray = new String[failedFolders.size()];
        String[] failedPositionsArray = new String[failedPositions.size()];

        failedFolders.toArray(failedFoldersArray);
        failedPositions.toArray(failedPositionsArray);

        DialogFragment newFragment = new RemovingFilesErrorDialogFragment();
        Bundle arguments = new Bundle();
        arguments.putStringArray(RemovingFilesErrorDialogFragment.FOLDERS_TAG, failedFoldersArray);
        arguments.putStringArray(RemovingFilesErrorDialogFragment.POSITIONS_TAG, failedPositionsArray);
        newFragment.setArguments(arguments);
        newFragment.show(getSupportFragmentManager(), "removingElementsError");
    }

    refreshList();
}

From source file:net.potterpcs.recipebook.DirectionsEditor.java

@Override
public void onSaveInstanceState(Bundle outState) {
    // Save the directions and photos arrays, so that we can refill the
    // lists after a pause/restore.
    super.onSaveInstanceState(outState);
    outState.putStringArray(STATE_DIRS, getDirections());
    outState.putStringArray(STATE_PHOTOS, getPhotos());
}

From source file:de.tudarmstadt.dvs.myhealthassistant.myhealthhub.fragments.SensorConfigFragment.java

/**
 * Open up a new tab for setting up sensors
 * /*from   w ww.j av a 2s. c  o  m*/
 * @param sensorType
 * @param sensorNames
 */
private void openSetupSensorActivity(String sensorType, String[] sensorNames) {
    Intent intent = new Intent(getActivity().getApplicationContext(), SensorSettingsActivity.class);
    Bundle arg = new Bundle();
    arg.putString("type", sensorType);
    arg.putStringArray("names", sensorNames);
    intent.putExtras(arg);
    startActivity(intent);
}

From source file:de.aw.monma.actions.FragmentWPList.java

@Override
protected void setInternalArguments(Bundle args) {
    super.setInternalArguments(args);
    args.putParcelable(DBDEFINITION, tbd);
    args.putInt(VIEWHOLDERLAYOUT, itemLayout);
    args.putStringArray(PROJECTION, projection);
    args.putString(SELECTION, selection);
    args.putStringArray(SELECTIONARGS, selectionArgs);
    args.putString(ORDERBY, orderBy);/*from w  ww  .  j  a v a 2s  .co  m*/
    onlyBestand = args.getBoolean(ONLYBESTAND, true);
    sortieren = args.getBoolean(SORTIEREN, false);
}

From source file:net.xisberto.phonetodesktop.SendTasksActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putStringArray(SAVE_CACHE_UNSHORTEN, cache_unshorten);
    outState.putStringArray(SAVE_CACHE_TITLES, cache_titles);
    outState.putBoolean(SAVE_IS_WAITING, isWaiting);
    outState.putLong(SAVE_LOCAL_TASK_ID, localTask.getLocalId());
}

From source file:net.naonedbus.activity.MenuDrawerActivity.java

@Override
protected void onSaveInstanceState(final Bundle outState) {
    outState.putInt(BUNDLE_MENU_POSITION, mCurrentMenuItem);
    outState.putStringArray(BUNDLE_FRAGMENTS_TAGS, mFragmentsTags);
    super.onSaveInstanceState(outState);
}