java - How to convert String Values to Integer Array List - Android -



java - How to convert String Values to Integer Array List - Android -

i want input 3 info 3 edittext fields , want display bar-chart.

here code section. give me solution these errors..

i tried bar chart using code. not working. comment //error point

protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.getfromdb); final string[] mmonth = new string[] { "jan", "feb" , "mar", "apr", "may", "jun", "jul", "aug" , "sep", "oct", "nov", "dec" }; final edittext t1 =(edittext)findviewbyid(r.id.textview1); final edittext t2 =(edittext)findviewbyid(r.id.textview2); final edittext t3 =(edittext)findviewbyid(r.id.textview3); button btnchart = (button) findviewbyid(r.id.btnview); int x1 = integer.parseint(t1.gettext().tostring()); int x2 = integer.parseint(t2.gettext().tostring()); int x3 = integer.parseint(t3.gettext().tostring()); btnchart.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { openchart(); } private void openchart() { int x1 = integer.parseint(t1.gettext().tostring()); int x2 = integer.parseint(t2.gettext().tostring()); int x3 = integer.parseint(t3.gettext().tostring()); int[] x = { 0,1,2 }; int [] income = {x1 ,x2, x3}; //error point xyseries incomeseries = new xyseries("pulse rate"); xyseries expenseseries = new xyseries(""); for(int i=0;i<x.length;i++){ incomeseries.add(i,income[i]); } xymultipleseriesdataset dataset = new xymultipleseriesdataset(); dataset.addseries(incomeseries); dataset.addseries(expenseseries); xyseriesrenderer incomerenderer = new xyseriesrenderer(); incomerenderer.setcolor(color.rgb(130, 130, 230)); incomerenderer.setfillpoints(true); incomerenderer.setlinewidth(2); incomerenderer.setdisplaychartvalues(true); xyseriesrenderer expenserenderer = new xyseriesrenderer(); expenserenderer.setcolor(color.rgb(220, 80, 80)); expenserenderer.setfillpoints(true); expenserenderer.setlinewidth(2); expenserenderer.setdisplaychartvalues(true); xymultipleseriesrenderer multirenderer = new xymultipleseriesrenderer(); multirenderer.setxlabels(0); multirenderer.setcharttitle("pulse chart"); multirenderer.setxtitle("pulse rate"); multirenderer.setytitle("days"); multirenderer.setzoombuttonsvisible(true); for(int i=0; i< x.length;i++){ multirenderer.addxtextlabel(i, mmonth[i]); } multirenderer.addseriesrenderer(incomerenderer); multirenderer.addseriesrenderer(expenserenderer); intent intent = chartfactory.getbarchartintent(getbasecontext(), dataset, multirenderer, type.default); startactivity(intent); } }); } private void setlistadapter(simplecursoradapter adapter) { // todo auto-generated method stub }

i comment //error point in code segment. when give values point a

int [] income = {60 ,40, 50}; //it should working

then should working.. want set these values using edittext boxes.

try line

int x1 = integer.parseint(t1.gettext().tostring());

java android arrays integer

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -