AdapterView.OnItemClickListener itemClickListener = new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView arg0, View arg1, int position, long id) { // AdapterView is the parent class of ListView CheckBox c = (CheckBox) arg1.findViewById(R.id.checkbox1);
String selected = ((TextView) arg1.findViewById(R.id.user_name_inbox)).getText().toString();
HashMap<String, String> m = inboxlist.get(0);
if (c.isChecked()) {
c.setChecked(false);
checkedPositions.add(position);
Log.d(TAG, "Item is unchecked at position: " + position);
} else {
c.setChecked(true);
checkedPositions.add(position);
}
StringBuilder commaSepValueBuilder = new StringBuilder();
//Looping through the list
for (int i = 0; i< inboxlist.size(); i++){
//append the value into the builder
commaSepValueBuilder.append(inboxlist.get(i));
//if the value is not the last element of the list
//then append the comma(,) as well
if ( i != inboxlist.size()-1){
commaSepValueBuilder.append(", ");
}
}
System.out.println(commaSepValueBuilder.toString());
Toast.makeText(getApplicationContext(),commaSepValueBuilder.toString(),Toast.LENGTH_LONG).show();
}
Aucun commentaire:
Enregistrer un commentaire