Search Results

Search found 1 results on 1 pages for 'raghs'.

Page 1/1 | 1 

  • custom ListView --Null pointer exception

    - by raghs
    this code throws a Null pointer exception. It was thrown by getChildAt(i). The getCount() returns the number of items in listView. But getChildAt(i) returns only if item is present in current list view. For example in a scrollable list view assume that there are 20 items. The getCount() returns 20. But getChildAt(20) returns null. Because it doesnot fit in listview. How to solve this problem?? int i,j=object.getCount(); View v=getListView(); CheckBox chk=null; for(i=0;i<j;i++) { chk=((CheckBox)((ViewGroup) v).getChildAt(i).findViewById(R.id.checkBox1)); if(chk.isChecked()) { //download the contents to specific folder in sd card } }

    Read the article

1