Code example for SparseBooleanArray

Methods: keyAtsizevalueAt

0
	public void makeToast(MenuItem menu){
		ListView lv = (ListView)findViewById(android.R.id.list);
		recipientsArray = lv.getCheckedItemPositions();
		 
		if (recipientsArray != null){
			for(int i=0; i<recipientsArray.size(); i++){
				if (recipientsArray.valueAt(i)){
					String item = lv.getAdapter().getItem(recipientsArray.keyAt(i)).toString();
					Log.i(TAG, item + " was selected");
				} 
			} 
		} 
			 
		Toast.makeText(SelectRecipients.this, "Sending an image from "+name+" to "+ prettyNames(recipientsArray) +" for "+length+"", Toast.LENGTH_LONG).show();		
	} 
	 
	private String prettyNames(SparseBooleanArray sba){
		String names = "";
		for (int i = 0; i < sba.size(); i++){
			names = names + sba.valueAt(i);
		} 
		return names;
	} 
	 
	private void fillData(){ 
Connect your IDE to all the code out there  Get Codota for Java