Bundle getInt - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Bundle getInt method.

This code example shows how to use the following methods:getInt, putInt
    assertTrue(bundle.containsKey("foo"));
  } 
 
  @Test 
  public void testInt() { 
    bundle.putInt("foo", 5);
    assertEquals(5,bundle.getInt("foo"));
    assertEquals(0,bundle.getInt("bar"));
    assertEquals(7, bundle.getInt("bar", 7));
  } 
 
  @Test 
  public void testSize() { 
    assertEquals(0, bundle.size());
    bundle.putInt("foo", 5);
    assertEquals(1, bundle.size());
    bundle.putInt("bar", 5);
    assertEquals(2, bundle.size());
  } 
 
8
CodeRank
This code example shows how to use the following methods:getInt, putInt
        assertTrue(bundle.containsKey("foo"));
    } 
 
    @Test 
    public void testInt() { 
        bundle.putInt("foo", 5);
        assertEquals(5,bundle.getInt("foo"));
        assertEquals(0,bundle.getInt("bar"));
        assertEquals(7, bundle.getInt("bar", 7));
    } 
 
    @Test 
    public void testSize() { 
        assertEquals(0, bundle.size());
        bundle.putInt("foo", 5);
        assertEquals(1, bundle.size());
        bundle.putInt("bar", 5);
        assertEquals(2, bundle.size());
    } 
 
8
CodeRank
This code example shows how to use the following methods:getInt, getString
        throwBundle(b);
        return b.getByteArray("out");
    } 
 
    private static void throwBundle(Bundle b) throws EeIOException {
        switch (b.getInt("e")) {
            case EE_ERROR_NFC_DISABLED:
                throw new EeNfcDisabledException(b.getString("m"));
            case EE_ERROR_IO:
                throw new EeIOException(b.getString("m"));
            case EE_ERROR_INIT:
                throw new EeInitializationException(b.getString("m"));
            case EE_ERROR_EXT_FIELD:
                throw new EeExternalFieldException(b.getString("m"));
            case EE_ERROR_LISTEN_MODE:
                throw new EeListenModeException(b.getString("m"));
            case EE_ERROR_ALREADY_OPEN:
                throw new EeAlreadyOpenException(b.getString("m"));
        } 
    } 

7
CodeRank
This code example shows how to use the following methods:getInt
	} 
 
	@Override 
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		if (savedInstanceState != null)
			mColorRes = savedInstanceState.getInt("mColorRes");
		int color = getResources().getColor(mColorRes);
		// construct the RelativeLayout 
		RelativeLayout v = new RelativeLayout(getActivity());
		v.setBackgroundColor(color);		
		return v;
	} 
	 
	@Override 
	public void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		outState.putInt("mColorRes", mColorRes);
	} 
	 
} 
7
CodeRank
This code example shows how to use the following methods:getInt
		outState.putInt("oldValue", mOldValue);
	} 
 
	@Override 
	void restoreState(Bundle inState) {
		super.restoreState(inState);
 
		mCellRow = inState.getInt("cellRow");
		mCellColumn = inState.getInt("cellColumn");
		mValue = inState.getInt("value");
		mOldValue = inState.getInt("oldValue");
	} 
 
	@Override 
	void execute() { 
		Cell cell = getCells().getCell(mCellRow, mCellColumn);
		mOldValue = cell.getValue();
		cell.setValue(mValue);
	} 
 
8
CodeRank
This code example shows how to use the following methods:getInt
                 getSupportActionBar().getSelectedNavigationIndex()); 
  } 
 
  @Override 
  public void onRestoreInstanceState(Bundle state) {
    super.onRestoreInstanceState(state);
 
    getSupportActionBar().setSelectedNavigationItem(state.getInt(STATE_NAV));
  } 
 
  private void initListNav() { 
    ArrayList<String> items=new ArrayList<String>();
    ArrayAdapter<String> nav=null;
    ActionBar bar=getSupportActionBar();
 
    for (int type : MAP_TYPE_NAMES) {
      items.add(getString(type));
    } 
 
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
7
CodeRank
This code example shows how to use the following methods:getBoolean, getInt
    } 
 
    @Override 
    public void onRestoreInstanceState(Bundle savedInstanceState) {
        super.onRestoreInstanceState(savedInstanceState);
        int year = savedInstanceState.getInt(YEAR);
        int month = savedInstanceState.getInt(MONTH);
        int day = savedInstanceState.getInt(DAY);
        boolean yearOptional = savedInstanceState.getBoolean(YEAR_OPTIONAL);
        mDatePicker.init(year, month, day, yearOptional, this);
        updateTitle(year, month, day);
    } 
} 
7
CodeRank
This code example shows how to use the following methods:containsKey, getInt
This code example shows how to use the following methods:getInt
    } 
  } 
 
  @Override 
  public void onRestoreInstanceState(Bundle state) {
    super.onRestoreInstanceState(state);
     
    pager.setCurrentItem(state.getInt(KEY_POSITION));
  } 
 
  @Override 
  public void onSaveInstanceState(Bundle state) {
    super.onSaveInstanceState(state);
     
    state.putInt(KEY_POSITION, pager.getCurrentItem());
  } 
 
  @Override 
  public void onTabSelected(Tab tab, FragmentTransaction ft) {
    Integer position=(Integer)tab.getTag();
7
CodeRank
This code example shows how to use the following methods:getInt
                              getSupportActionBar().getSelectedNavigationIndex()); 
  } 
   
  @Override 
  public void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
     
    getSupportActionBar().setSelectedNavigationItem(savedInstanceState.getInt(STATE_NAV));
  } 
 
  @Override 
  public void onInfoWindowClick(Marker marker) {
    Toast.makeText(this, marker.getTitle(), Toast.LENGTH_LONG).show();
  } 
 
  private void initListNav() { 
    ArrayList<String> items=new ArrayList<String>();
    ArrayAdapter<String> nav=null;
    ActionBar bar=getSupportActionBar();
 
7
CodeRank

Related Bundle getInt Questions & Answers:

Other Bundle getInt Examples

16:			// Selected image id
17:			int position = i.getExtras().getInt("id");
18:			ImageAdapter imageAdapter = new ImageAdapter(this);
19:	
20:			ImageView imageView = (ImageView) findViewById(R.id.full_image_view);

Read More

221:				@Override
222:				public void onClick(View arg0) {
223:					if(isShuffle){
224:						isShuffle = false;
225:						Toast.makeText(getApplicationContext(), "Shuffle is OFF", Toast.LENGTH_SHORT).show();

Read More

7:	        if(resultCode == 100){
8:	         	 currentSongIndex = data.getExtras().getInt("songIndex");
9:	         	 // play selected song
10:	             playSong(currentSongIndex);
11:	        }

Read More

getInt Method Overview
Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.
See Code Examples for other Android Bundle Methods: