Example usage for android.os Bundle getStringArray

List of usage examples for android.os Bundle getStringArray

Introduction

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

Prototype

@Nullable
public String[] getStringArray(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:uk.co.senab.photoview.sample.ImagePagerActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_pager);
    mViewPager = (HackyViewPager) findViewById(R.id.view_pager);
    setContentView(mViewPager);/*from  w ww  .ja v a 2s.co  m*/

    Bundle bundle = getIntent().getExtras();
    imageUrls = bundle.getStringArray("images");
    if (imageUrls == null) {
        this.finish();
        return;
    }
    int pagerPosition = bundle.getInt("position", 0);

    SamplePagerAdapter adapter = new SamplePagerAdapter(imageUrls);
    mViewPager.setAdapter(adapter);
    mViewPager.setCurrentItem(pagerPosition);

    if (savedInstanceState != null) {
        boolean isLocked = savedInstanceState.getBoolean(ISLOCKED_ARG, false);
        ((HackyViewPager) mViewPager).setLocked(isLocked);
    }

    options = new DisplayImageOptions.Builder().showImageForEmptyUri(R.mipmap.ic_empty)
            .showImageOnFail(R.mipmap.ic_error).resetViewBeforeLoading(true).cacheOnDisc(true)
            .imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565).considerExifParams(true)
            .displayer(new FadeInBitmapDisplayer(300)).build();

}

From source file:com.tundem.aboutlibraries.ui.LibsFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);

    String[] fields = null;//w  w w  .  j  a v  a2 s.co m
    String[] internalLibraries = null;
    String[] excludeLibraries = null;

    //read and get our arguments
    Bundle bundle = getArguments();
    if (bundle != null) {
        fields = bundle.getStringArray(Libs.BUNDLE_FIELDS);
        internalLibraries = bundle.getStringArray(Libs.BUNDLE_LIBS);
        excludeLibraries = bundle.getStringArray(Libs.BUNDLE_EXCLUDE_LIBS);

        autoDetect = bundle.getBoolean(Libs.BUNDLE_AUTODETECT, true);
        sort = bundle.getBoolean(Libs.BUNDLE_SORT, true);

        showLicense = bundle.getBoolean(Libs.BUNDLE_LICENSE, false);
        showLicenseDialog = bundle.getBoolean(Libs.BUNDLE_LICENSE_DIALOG, true);
        showVersion = bundle.getBoolean(Libs.BUNDLE_VERSION, false);
    }

    //init the Libs instance with fields if they were set
    if (fields == null) {
        libs = new Libs(getActivity());
    } else {
        libs = new Libs(getActivity(), fields);
    }

    //The last step is to look if we would love to show some about text for this project
    String descriptionShowIcon = libs.getStringResourceByName("aboutLibraries_description_showIcon");
    if (!TextUtils.isEmpty(descriptionShowIcon)) {
        try {
            aboutShowIcon = Boolean.parseBoolean(descriptionShowIcon);
        } catch (Exception ex) {
        }
    }
    String descriptionShowVersion = libs.getStringResourceByName("aboutLibraries_description_showVersion");
    if (!TextUtils.isEmpty(descriptionShowIcon)) {
        try {
            aboutShowVersion = Boolean.parseBoolean(descriptionShowVersion);
        } catch (Exception ex) {
        }
    }

    aboutDescription = Html.fromHtml(libs.getStringResourceByName("aboutLibraries_description_text"));

    //fetch the libraries and sort if a comparator was set
    libraries = libs.prepareLibraries(internalLibraries, excludeLibraries, autoDetect, sort);

    if (comparator != null) {
        Collections.sort(libraries, comparator);
    }
}

From source file:net.simonvt.cathode.util.FragmentStack.java

public void restoreState(Bundle inState) {
    String[] stackTags = inState.getStringArray(STATE_STACK);
    for (String tag : stackTags) {
        Fragment f = fragmentManager.findFragmentByTag(tag);
        stack.add(f);//w  w w .  j a v  a2  s .  c om
    }
    dispatchOnStackChangedEvent();
}

From source file:org.onebusaway.android.directions.realtime.RealtimeService.java

private ItineraryDescription getItineraryDescription(Bundle bundle) {
    String ids[] = bundle.getStringArray(ITINERARY_DESC);
    long date = bundle.getLong(ITINERARY_END_DATE);
    return new ItineraryDescription(Arrays.asList(ids), new Date(date));
}

From source file:ca.mudar.parkcatcher.ui.fragments.FavoritesFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {

    String[] selectionArgs = null;
    if (id == FavoritesQuery._TOKEN && args.containsKey(Const.KEY_BUNDLE_CURSOR_SELECTION)) {
        selectionArgs = args.getStringArray(Const.KEY_BUNDLE_CURSOR_SELECTION);
    }/*w  ww.  j  a v  a  2 s.  c  o  m*/

    return new CursorLoader(getSherlockActivity().getApplicationContext(), Posts.CONTENT_STARRED_URI,
            FavoritesQuery.FAVORITES_SUMMARY_PROJECTION, null, selectionArgs, Posts.FORBIDDEN_DISTANCE_SORT);
}

From source file:uk.org.rivernile.edinburghbustracker.android.fragments.dialogs.ServicesChooserDialogFragment.java

/**
 * {@inheritDoc}//w w w  .  ja v  a 2  s  .  c o m
 */
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final Bundle args = getArguments();
    services = args.getStringArray(ARG_SERVICES);

    // Do sanity checks.
    if (services == null || services.length == 0) {
        throw new IllegalArgumentException("A list of services must " + "be supplied.");
    }

    if (savedInstanceState != null) {
        // If there is a previous instance, get the args from the saved
        // instance state.
        checkBoxes = savedInstanceState.getBooleanArray(ARG_CHECK_BOXES);
    } else {
        final String[] selectedServices = args.getStringArray(ARG_SELECTED_SERVICES);

        checkBoxes = new boolean[services.length];

        if (selectedServices != null && selectedServices.length > 0) {
            int i;
            final int len = services.length;
            for (i = 0; i < len; i++) {
                for (String s : selectedServices) {
                    if (services[i].equals(s)) {
                        checkBoxes[i] = true;
                        break;
                    }
                }
            }
        }
    }
}

From source file:gov.wa.wsdot.android.wsdot.ui.camera.CameraListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    Bundle args = getActivity().getIntent().getExtras();
    cameraIds = args.getIntArray("cameraIds");
    cameraUrls = args.getStringArray("cameraUrls");

    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_recycler_with_spinner, null);

    mRecyclerView = (RecyclerView) root.findViewById(R.id.my_recycler_view);
    mRecyclerView.setHasFixedSize(true);
    mLayoutManager = new LinearLayoutManager(getActivity());
    mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mAdapter = new CameraGroupImageAdapter(getActivity(), null);

    mRecyclerView.setAdapter(mAdapter);//from   w  w  w  . j a  va2  s  . c  o m

    mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(getActivity()));

    // For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
    // FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    mLoadingSpinner = root.findViewById(R.id.loading_spinner);
    mEmptyView = root.findViewById(R.id.empty_list_view);

    return root;
}

From source file:it.polimi.spf.app.fragments.profile.ProfileFieldsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    Bundle b = savedInstanceState == null ? getArguments() : savedInstanceState;

    if (b == null) {
        throw new IllegalArgumentException("No bundle to read data from");
    }/*ww  w  .j a v  a  2s  . co  m*/

    mFieldsToShow = ProfileField.fromIdentifierList(b.getStringArray(EXTRA_FIELDS_TO_SHOW));
    mViewContainer = (LinearLayout) getView().findViewById(R.id.profileedit_field_container);
    mParent = (ProfileFragment) getParentFragment();
    onRefresh();
}

From source file:net.simonvt.fragmentstack.FragmentStack.java

public void restoreState(Bundle state) {
    String[] stackTags = state.getStringArray(STATE_STACK);
    for (String tag : stackTags) {
        Fragment f = fragmentManager.findFragmentByTag(tag);
        stack.add(f);/*from  ww w. j a v  a 2s. com*/
    }
    dispatchOnStackChangedEvent();
}

From source file:com.piusvelte.wapdroid.ManageData.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    switch (id) {
    case DATA_LOADER:
        return new CursorLoader(getActivity(), Networks.CONTENT_URI, args.getStringArray(PROJECTION),
                args.getString(SELECTION), args.getStringArray(SELECTION_ARGS), STATUS);

    default://from ww w .j  a  v a 2 s.c  o m
        return null;
    }
}