android - achartengine intent wont start -
i'm working on app plots user data chartengine lib. have tab application , chart plot works anywhere not activities load tabs. wonder why , if can me?
this works:
public class dataactivity extends activity { static final int series_nr = 3; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); setcontentview(r.layout.data_form); xymultipleseriesrenderer renderer = gettruitonbarrenderer(); mychartsettings(renderer); intent = chartfactory.getbarchartintent(dataactivity.this, gettruitonbardataset(), renderer, type.default); startactivity(i); } private xymultipleseriesdataset gettruitonbardataset() { xymultipleseriesdataset dataset = new xymultipleseriesdataset(); final int nr = 11; random r = new random(); arraylist<string> legendtitles = new arraylist<string>(); legendtitles.add("sales"); legendtitles.add("expenses"); legendtitles.add("age"); (int = 0; < series_nr; i++) { categoryseries series = new categoryseries(legendtitles.get(i)); (int k = 0; k < nr; k++) { series.add(k+ r.nextint() % 100); } dataset.addseries(series.toxyseries()); } return dataset; } public xymultipleseriesrenderer gettruitonbarrenderer() { xymultipleseriesrenderer renderer = new xymultipleseriesrenderer(); renderer.setaxistitletextsize(16); renderer.setcharttitletextsize(20); renderer.setlabelstextsize(15); renderer.setlegendtextsize(15); renderer.setmargins(new int[] { 30, 40, 15, 0 }); simpleseriesrenderer r = new simpleseriesrenderer(); r.setcolor(color.blue); renderer.addseriesrenderer(r); r = new simpleseriesrenderer(); r.setcolor(color.red); renderer.addseriesrenderer(r); r = new simpleseriesrenderer(); r.setcolor(color.cyan); renderer.addseriesrenderer(r); return renderer; } private void mychartsettings(xymultipleseriesrenderer renderer) { renderer.setcharttitle("achart engine mahdi tajik"); renderer.setxaxismin(0.5); renderer.setxaxismax(10.5); renderer.setyaxismin(0); renderer.setyaxismax(210); renderer.addxtextlabel(1, "2010"); renderer.addxtextlabel(2, "2011"); renderer.addxtextlabel(3, "2012"); renderer.addxtextlabel(4, "2013"); renderer.addxtextlabel(5, "2013"); renderer.addxtextlabel(6, "2013"); renderer.addxtextlabel(7, "2012"); renderer.addxtextlabel(8, "20123"); renderer.addxtextlabel(9, "201223"); renderer.addxtextlabel(10, "2022213"); renderer.addxtextlabel(11, "20122223"); renderer.setylabelsalign(align.right); renderer.setbarspacing(0.5); renderer.setxtitle("years"); renderer.setytitle("performance"); renderer.setshowgrid(true); renderer.setgridcolor(color.gray); renderer.setxlabels(0); // sets number of integer labels appear } }
but wont work:
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //requestwindowfeature(window.feature_no_title); setcontentview(r.layout.static_form); initilizeui(); } private void plotweekstatics(){ xymultipleseriesrenderer renderer = gettruitonbarrenderer(); mychartsettings(renderer); intent = chartfactory.getbarchartintent(staticactivity.this, gettruitonbardataset(), renderer, type.default); startactivity(i); } private xymultipleseriesdataset gettruitonbardataset() { xymultipleseriesdataset dataset = new xymultipleseriesdataset(); final int nr = 11; random r = new random(); arraylist<string> legendtitles = new arraylist<string>(); legendtitles.add("sales"); legendtitles.add("expenses"); legendtitles.add("age"); (int = 0; < series_nr; i++) { categoryseries series = new categoryseries(legendtitles.get(i)); (int k = 0; k < nr; k++) { series.add(k+ r.nextint() % 100); } dataset.addseries(series.toxyseries()); } return dataset; } public xymultipleseriesrenderer gettruitonbarrenderer() { xymultipleseriesrenderer renderer = new xymultipleseriesrenderer(); renderer.setaxistitletextsize(16); renderer.setcharttitletextsize(20); renderer.setlabelstextsize(15); renderer.setlegendtextsize(15); renderer.setmargins(new int[] { 30, 40, 15, 0 }); simpleseriesrenderer r = new simpleseriesrenderer(); r.setcolor(color.blue); renderer.addseriesrenderer(r); r = new simpleseriesrenderer(); r.setcolor(color.red); renderer.addseriesrenderer(r); r = new simpleseriesrenderer(); r.setcolor(color.cyan); renderer.addseriesrenderer(r); return renderer; } private void mychartsettings(xymultipleseriesrenderer renderer) { renderer.setcharttitle("achart engine mahdi tajik"); renderer.setxaxismin(0.5); renderer.setxaxismax(10.5); renderer.setyaxismin(0); renderer.setyaxismax(210); renderer.addxtextlabel(1, "2010"); renderer.addxtextlabel(2, "2011"); renderer.addxtextlabel(3, "2012"); renderer.addxtextlabel(4, "2013"); renderer.addxtextlabel(5, "2013"); renderer.addxtextlabel(6, "2013"); renderer.addxtextlabel(7, "2012"); renderer.addxtextlabel(8, "20123"); renderer.addxtextlabel(9, "201223"); renderer.addxtextlabel(10, "2022213"); renderer.addxtextlabel(11, "20122223"); renderer.setylabelsalign(align.right); renderer.setbarspacing(0.5); renderer.setxtitle("years"); renderer.setytitle("performance"); renderer.setshowgrid(true); renderer.setgridcolor(color.gray); renderer.setxlabels(0); // sets number of integer labels appear }
why same code work in 1 activity not in must in second code sample loads tabactivity.
i solve problem. problem wont define achartactivity in manifest file this:
<activity android:name="org.achartengine.graphicalactivity"/>
and adding app works correctly. :)
Comments
Post a Comment