android - getCheckedItemIds().length don't return correct value -


i have read topic whats equivilent of getcheckeditemcount() api level < 11?
lv.getcheckitemids().length can correct sum of checked items,
lv.getcheckeditemids().length can't, why? thanks!

private void initlistview(int pos) {     list<string> msglist = getsms(pos);     arrayadapter<string> adapter2 = new arrayadapter<string>(this,             android.r.layout.simple_list_item_multiple_choice, msglist);     lv.setadapter(adapter2);     lv.setchoicemode(listview.choice_mode_multiple);     lv.setonitemclicklistener(new onitemclicklistener() {         @override         public void onitemclick(adapterview<?> arg0, view arg1, int arg2,                 long arg3) {             setselectedandtotal();         }     }); }  private void setselectedandtotal(){     selectedandtotal.settext(lv.getcheckitemids().length + "/"+lv.getcheckeditemids().length+ "/"             + lv.getcount());        } 

    public long[] getcheckitemids (); 

this method deprecated in api level 8.

use getcheckeditemids() instead returns set of checked items ids. result valid if choice mode has not been set choice_mode_none.

returns

a new array contains id of each checked item in list.

   public long[] getcheckeditemids (); 

returns set of checked items ids. result valid if choice mode has not been set choice_mode_none , adapter has stable ids.

(hasstableids() == true) 

returns

a new array contains id of each checked item in list.

check out here more details.

i hope you.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -