Why can getCheckedItemCount() run correctly when I set android:minSdkVersion="10"? -
when set android:minsdkversion="8", following code can't run,and system prompt me set android:minsdkversion="11" set android:minsdkversion="10", code can run correctly, why? thanks!
lv.setonitemclicklistener(new onitemclicklistener(){ @override public void onitemclick(adapterview<?> arg0, view arg1, int arg2,long arg3) { selectedandtotal.settext(lv.getcheckeditemcount()+"/"+ lv.getcount()); }});
that method guaranteed work when run on api level 11+ device.
normally, method call crash on api level 10 or lower device, throwing verifyerror
. if find seems work on api level 10 or lower, indicates getcheckeditemcount()
existed on abslistview
prior api level 11, had been excluded android sdk (via @hide
attribute in android source code). relying upon such methods risky, insofar there no guarantee abslistview
on pre-api level 11 devices have method, or method behave on newer devices.
Comments
Post a Comment