android - SQLite database Text column parser to double -


i wanted query sqlite db , query cost, text in sqlite.
want sum of column value.

how do it?
here's code

public class estimate extends appcompatactivity {      databasehandler db;     textview tv;     @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_estimate);         db=new databasehandler(this);         tv=(textview)findviewbyid(r.id.textview2);         tv.settext("joma="+getjoma()+"");      }     public double getjoma(){          double sum=0.0;         sqlitedatabase dt = db.getreadabledatabase();         cursor res = dt.rawquery("select cost tb type=জমা",null);          do{             sum =sum+ double.parsedouble(res.getstring(res.getcolumnindex("cost")));         }         while(res.movetonext());       return sum;     } } 


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -