android - error at closing database in customadapter? -


i trying implement listview adapter, in adapter wrote code

try {     dbhelper = new dbhelper(context);     database=dbhelper.getreadabledatabase();     string id = deviceid.tostring().trim();                          string query = ("select pond, maxvalue ,minvalue,maxphvalue,minphvalue ponddata   pond ='" + id + "'");     cursor1 = database.rawquery(query, null);     if(cursor1 != null){         if(cursor1.movetolast()){                                                                     string maxvalue =cursor1.getstring(cursor1.getcolumnindex("maxvalue"));             string minvalue =cursor1.getstring(cursor1.getcolumnindex("minvalue"));              string maxphval = cursor1.getstring(cursor1.getcolumnindex("maxphvalue"));             string minphval = cursor1.getstring(cursor1.getcolumnindex("minphvalue"));              float min = float.parsefloat(minvalue);             float max = float.parsefloat(maxvalue);             applicationdata.addmin(min);             applicationdata.addmax(max);              float min1=float.parsefloat(minphval);             float max1=float.parsefloat(maxphval);             applicationdata.addmin1(min1);             applicationdata.addmax1(max1);          }                                    cursor1.movetonext();        }     } {   cursor1.close();   database.close(); } 

but showing error @ cursor1.closse() database.close(). fatal exception process com.eample.test process :pid 11536 null pointer exception @ adapter.getview. please 1 why showing error. trying resolve error morning. please help.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -