Example usage for android.os Bundle getIntegerArrayList

List of usage examples for android.os Bundle getIntegerArrayList

Introduction

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

Prototype

@Override
@Nullable
public ArrayList<Integer> getIntegerArrayList(@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:Main.java

public static String toString(Intent intent) {
    StringBuilder sb = new StringBuilder();
    sb.append(intent.getAction()).append(" ");

    Bundle bundle = intent.getExtras();
    if (bundle != null) {
        Set<String> sets = bundle.keySet();
        for (String key : sets) {
            if (bundle.get(key) instanceof Integer) {
                sb.append(key).append(":").append(bundle.getInt(key)).append("\n");
            } else if (bundle.get(key) instanceof ArrayList) {
                sb.append(key).append(":").append(Arrays.toString(bundle.getIntegerArrayList(key).toArray()))
                        .append("\n");
            } else if (bundle.get(key) instanceof Parcelable) {
                sb.append(key).append(":").append(bundle.getParcelable(key).toString()).append("\n");
            } else {
                sb.append(key).append(":").append(bundle.getString(key)).append("\n");
            }//from w w  w .ja  v a  2s.c o  m
        }

    }

    return sb.toString();
}

From source file:com.btmura.android.reddit.app.ThingPagerAdapter.java

@Override
public void restoreState(Parcelable state, ClassLoader loader) {
    super.restoreState(state, loader);
    if (state != null) {
        Bundle bundle = (Bundle) state;
        pageTypes.clear();/*from w  w  w  .j a v a2s  .  c  o m*/
        pageTypes.addAll(bundle.getIntegerArrayList(STATE_PAGE_TYPES));
        oldPageTypes.clear();
        oldPageTypes.addAll(bundle.getIntegerArrayList(STATE_OLD_PAGE_TYPES));
        notifyDataSetChanged();
    }
}

From source file:com.nextgis.maplibui.control.PhotoGallery.java

@Override
protected void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;

        if (bundle.containsKey(BUNDLE_DELETED_IMAGES)) {
            ArrayList<Integer> deletedImages = bundle.getIntegerArrayList(BUNDLE_DELETED_IMAGES);

            if (deletedImages != null)
                mDeletedImages.addAll(deletedImages);
        }/*from  w  w  w  .j av  a2  s.  co m*/
    }

    super.onRestoreInstanceState(state);
}

From source file:org.thbz.hanguldrill.ConfigManageDialogFragment.java

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

    configsSelected = new HashSet<>();
    if (savedInstanceState != null)
        configsSelected.addAll(savedInstanceState.getIntegerArrayList(CONFIGSSELECTEDKEY));
}

From source file:com.example.android.android_me.ui.BodyPartFragment.java

/**
 * Inflates the fragment layout file and sets the correct resource for the image to display
 */// ww  w  .  j  a va  2s .  c o m
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    // Inflate the Android-Me fragment layout
    View rootView = inflater.inflate(R.layout.fragment_body_part, container, false);

    //Check bundle
    if (savedInstanceState != null) {
        mImageIds = savedInstanceState.getIntegerArrayList(IMAGE_ID_LIST);
        mListIndex = savedInstanceState.getInt(LIST_INDEX);
    }

    // Get a reference to the ImageView in the fragment layout
    final ImageView imageView = (ImageView) rootView.findViewById(R.id.body_part_image_view);

    // If a list of image ids exists, set the image resource to the correct item in that list
    // Otherwise, create a Log statement that indicates that the list was not found
    if (mImageIds != null) {
        // Set the image resource to the list item at the stored index
        imageView.setImageResource(mImageIds.get(mListIndex));

        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mListIndex < mImageIds.size() - 1) {
                    mListIndex++;
                } else {
                    mListIndex = 0;
                }
                imageView.setImageResource(mImageIds.get(mListIndex));
            }
        });

    } else {
        Log.v(TAG, "This fragment has a null list of image id's");
    }

    // Return the rootView
    return rootView;
}

From source file:com.chute.android.photopickerplus.ui.activity.AssetActivity.java

private void retrieveSavedValuesFromBundle(Bundle savedInstanceState) {
    selectedAccountsPositions = savedInstanceState != null
            ? savedInstanceState.getIntegerArrayList(Constants.KEY_SELECTED_ACCOUNTS_ITEMS)
            : null;/*w  w w .  j  av  a2  s .c o m*/

    selectedImagesPositions = savedInstanceState != null
            ? savedInstanceState.getIntegerArrayList(Constants.KEY_SELECTED_IMAGES_ITEMS)
            : null;

    if (selectedImagesPositions != null) {
        ALog.d("retrieve positions : " + selectedImagesPositions.toString());
    }

    selectedVideosPositions = savedInstanceState != null
            ? savedInstanceState.getIntegerArrayList(Constants.KEY_SELECTED_VIDEOS_ITEMS)
            : null;

    folderId = savedInstanceState != null ? savedInstanceState.getString(Constants.KEY_FOLDER_ID) : null;
}

From source file:com.owner.disclosureyourlife.ImagePagerActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ac_image_pager);

    back = (Button) findViewById(R.id.back);
    title = (TextView) findViewById(R.id.embarrassTitle);
    title.setText(getString(R.string.plain_look_view_pager_title));
    back.setOnClickListener(l);//from  w ww. ja v a  2s  . c o  m
    Bundle bundle = getIntent().getExtras();
    assert bundle != null;
    imageUrls = bundle.getStringArrayList(Extra.IMAGES);
    ids = bundle.getIntegerArrayList(Extra.IDS);
    counts = bundle.getIntegerArrayList(Extra.COUNTS);
    bcounts = bundle.getIntegerArrayList(Extra.BCOUNTS);
    int pagerPosition = bundle.getInt(Extra.IMAGE_POSITION, 0);

    if (savedInstanceState != null) {
        pagerPosition = savedInstanceState.getInt(STATE_POSITION);
    }

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

    pager = (ViewPager) findViewById(R.id.pager);
    pager.setAdapter(new ImagePagerAdapter(imageUrls));
    pager.setCurrentItem(pagerPosition);
}

From source file:com.getchute.android.photopickerplus.ui.activity.AssetActivity.java

private void retrieveSavedValuesFromBundle(Bundle savedInstanceState) {
    selectedAccountsPositions = savedInstanceState != null
            ? savedInstanceState.getIntegerArrayList(Constants.KEY_SELECTED_ACCOUNTS_ITEMS)
            : null;//from  ww  w.j  a  v  a2  s  .com

    selectedImagesPositions = savedInstanceState != null
            ? savedInstanceState.getIntegerArrayList(Constants.KEY_SELECTED_IMAGES_ITEMS)
            : null;

    selectedVideosPositions = savedInstanceState != null
            ? savedInstanceState.getIntegerArrayList(Constants.KEY_SELECTED_VIDEOS_ITEMS)
            : null;

    folderId = savedInstanceState != null ? savedInstanceState.getString(Constants.KEY_FOLDER_ID) : null;
}

From source file:ch.hesso.master.sweetcity.activity.report.ReportActivity.java

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

    bitmapPicture = savedInstanceState.getParcelable("image");
    ArrayList<Integer> positionList = savedInstanceState.getIntegerArrayList("tagList");
    CurrentTagList.getInstance().putAllFromPositions(tagList, positionList);

    Log.d(Constants.PROJECT_NAME, "positionList " + positionList.toString());

    showTagList();//from   www  .java2s .  com
    showPicture();
}

From source file:com.cerema.cloud2.ui.fragment.ExtendedListFragment.java

/**
 * {@inheritDoc}/*from  w  ww .j av  a  2s  .c om*/
 */
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    if (savedInstanceState != null) {
        mIndexes = savedInstanceState.getIntegerArrayList(KEY_INDEXES);
        mFirstPositions = savedInstanceState.getIntegerArrayList(KEY_FIRST_POSITIONS);
        mTops = savedInstanceState.getIntegerArrayList(KEY_TOPS);
        mHeightCell = savedInstanceState.getInt(KEY_HEIGHT_CELL);
        setMessageForEmptyList(savedInstanceState.getString(KEY_EMPTY_LIST_MESSAGE));

    } else {
        mIndexes = new ArrayList<Integer>();
        mFirstPositions = new ArrayList<Integer>();
        mTops = new ArrayList<Integer>();
        mHeightCell = 0;
    }
}