android - Unable to view chart -
i have created application want view chart.but when clicking on specified button,the app stops.. code follows..:
bloodsugarchart2.java
package com.example.app; import org.achartengine.chartfactory; import org.achartengine.chart.barchart.type; import org.achartengine.model.xymultipleseriesdataset; import org.achartengine.model.xyseries; import org.achartengine.renderer.xymultipleseriesrenderer; import org.achartengine.renderer.xyseriesrenderer; import android.app.activity; import android.content.intent; import android.graphics.color; import android.os.bundle; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; public class bloodsugarchart2 extends activity { private string[] mmonth = new string[] { "jan-10-14", "jan-11-14" , "jan-12-14", "jan-13-14", "jan-14-14", "jan-15-14", "jan-16-14", "jan-17-14" , "jan-18-14", "jan-19-14", "jan-20-14", "jan-21-14" }; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.blood_sugar_chart2); // getting reference button btn_chart button btnchart = (button) findviewbyid(r.id.btn_chart); // defining click event listener button btn_chart onclicklistener clicklistener = new onclicklistener() { @override public void onclick(view v) { // draw income vs expense chart openchart(); } }; // setting event click listener button btn_chart of mainactivity layout btnchart.setonclicklistener(clicklistener); } private void openchart(){ int[] x = { 0,1,2,3,4,5,6,7 }; int[] bloodsugar = { 2000,2500,2700,3000,2800,3500,3700,3800}; // creating xyseries income //categoryseries incomeseries = new categoryseries("income"); xyseries bloodsugarseries = new xyseries("blood sugar"); // creating xyseries income // adding data income , expense series for(int i=0;i<x.length;i++){ bloodsugarseries.add(i,bloodsugar[i]); } // creating dataset hold each series xymultipleseriesdataset dataset = new xymultipleseriesdataset(); // adding income series dataset dataset.addseries(bloodsugarseries); // adding expense series dataset // creating xyseriesrenderer customize incomeseries xyseriesrenderer bloodsugarrenderer = new xyseriesrenderer(); bloodsugarrenderer.setcolor(color.green); bloodsugarrenderer.setchartvaluesspacing((float) 0.5); bloodsugarrenderer.setfillpoints(true); bloodsugarrenderer.setlinewidth(2); bloodsugarrenderer.setdisplaychartvalues(true); // creating xymultipleseriesrenderer customize whole chart xymultipleseriesrenderer multirenderer = new xymultipleseriesrenderer(); multirenderer.setxlabels(0); multirenderer.setbarspacing(1); multirenderer.setcharttitle("blood sugar progress analysis report"); /*multirenderer.setxtitle("year 2012");*/ multirenderer.setytitle("blood sugar in mg/dl"); multirenderer.setzoombuttonsvisible(true); for(int i=0; i< x.length;i++){ multirenderer.addxtextlabel(i, mmonth[i]); } // adding incomerenderer , expenserenderer multiplerenderer // note: order of adding dataseries dataset , renderers multiplerenderer // should same multirenderer.addseriesrenderer(bloodsugarrenderer); // creating intent plot bar chart using dataset , multiplerenderer intent intent = chartfactory.getbarchartintent(getbasecontext(), dataset, multirenderer, type.default); // start activity startactivity(intent); } @override public boolean oncreateoptionsmenu(menu menu) { getmenuinflater().inflate(r.menu.blood_sugar_chart2, menu); return true; } }
blood_sugar_chart2.xml
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <button android:id="@+id/btn_chart" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_centervertical="true" android:text="@string/str_btn_chart" tools:context=".mainactivity" /> </relativelayout>
manifestfile.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.app" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="19" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/theme.appcompat" > <activity android:name="com.example.app.tabbar" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name="com.example.app.tab1" > </activity> <activity android:name="com.example.app.tab2" > </activity> <activity android:name="com.example.app.tab3" > </activity> <activity android:name="com.example.app.person" android:label="@string/title_activity_person" > </activity> <activity android:name="com.example.app.history" android:label="@string/title_activity_history" > </activity> <activity android:name="com.example.app.medications" android:label="@string/title_activity_medications" > </activity> <activity android:name="com.example.app.addmedrecords" android:label="@string/title_activity_add_med_records" > </activity> <activity android:name="com.example.app.officevisit" android:label="@string/title_activity_office_visit" > </activity> <activity android:name="com.example.app.addofficevisit" android:label="@string/title_activity_add_office_visit" > </activity> <activity android:name="com.example.app.officeinfo" android:label="@string/title_activity_office_info" > </activity> <activity android:name="com.example.app.addofficeinfo" android:label="@string/title_activity_add_office_info" > </activity> <activity android:name="com.example.app.officeinfoextradetails" android:label="@string/title_activity_office_info_extra_details" > </activity> <activity android:name="com.example.app.addperson" > </activity> <activity android:name="com.example.app.renameperson" android:label="@string/title_activity_rename_person" > </activity> <activity android:name="com.example.app.weight" android:label="@string/title_activity_weight" > </activity> <activity android:name="com.example.app.weightinfo" android:label="@string/title_activity_weight_info" > </activity> <activity android:name="com.example.app.bloodpressure" android:label="@string/title_activity_blood_pressure" > </activity> <activity android:name="com.example.app.addbloodpressureinfo" android:label="@string/title_activity_add_blood_pressure_info" > </activity> <activity android:name="com.example.app.bloodsugarcharts" android:label="@string/title_activity_blood_sugar_charts" > </activity> <activity android:name="com.example.app.bloodsugar" android:label="@string/title_activity_blood_sugar" > </activity> <activity android:name="com.example.app.addhistory" android:label="@string/title_activity_add_history" > </activity> <activity android:name="com.example.app.labandtestresults" android:label="@string/title_activity_lab_and_test_results" > </activity> <activity android:name="com.example.app.addlabtestresult" android:label="@string/title_activity_add_lab_test_result" > </activity> <activity android:name="com.example.app.dataanalysis" > </activity> <activity android:name="com.example.app.welcome" android:label="@string/title_activity_welcome" > </activity> <activity android:name="com.example.app.simplelistactivity" android:label="@string/title_activity_simple_list" > </activity> <activity android:name="com.example.app.weightcharts" android:label="@string/title_activity_weight_charts" > </activity> <activity android:name="com.example.app.bmicharts" android:label="@string/title_activity_bmicharts" > </activity> <activity android:name="com.example.app.bloodsugarchart2" android:label="@string/title_activity_blood_sugar_chart2" > </activity> </application> </manifest>
logcat
06-30 01:15:43.380: e/androidruntime(795): fatal exception: main 06-30 01:15:43.380: e/androidruntime(795): process: com.example.app, pid: 795 06-30 01:15:43.380: e/androidruntime(795): android.content.activitynotfoundexception: unable find explicit activity class {com.example.app/org.achartengine.graphicalactivity}; have declared activity in androidmanifest.xml? 06-30 01:15:43.380: e/androidruntime(795): @ android.app.instrumentation.checkstartactivityresult(instrumentation.java:1628) 06-30 01:15:43.380: e/androidruntime(795): @ android.app.instrumentation.execstartactivity(instrumentation.java:1424) 06-30 01:15:43.380: e/androidruntime(795): @ android.app.activity.startactivityforresult(activity.java:3424) 06-30 01:15:43.380: e/androidruntime(795): @ android.app.activity.startactivityforresult(activity.java:3385) 06-30 01:15:43.380: e/androidruntime(795): @ android.app.activity.startactivity(activity.java:3627) 06-30 01:15:43.380: e/androidruntime(795): @ android.app.activity.startactivity(activity.java:3595) 06-30 01:15:43.380: e/androidruntime(795): @ com.example.app.bloodsugarchart2.openchart(bloodsugarchart2.java:110) 06-30 01:15:43.380: e/androidruntime(795): @ com.example.app.bloodsugarchart2.access$0(bloodsugarchart2.java:47) 06-30 01:15:43.380: e/androidruntime(795): @ com.example.app.bloodsugarchart2$1.onclick(bloodsugarchart2.java:38) 06-30 01:15:43.380: e/androidruntime(795): @ android.view.view.performclick(view.java:4438) 06-30 01:15:43.380: e/androidruntime(795): @ android.view.view$performclick.run(view.java:18422) 06-30 01:15:43.380: e/androidruntime(795): @ android.os.handler.handlecallback(handler.java:733) 06-30 01:15:43.380: e/androidruntime(795): @ android.os.handler.dispatchmessage(handler.java:95) 06-30 01:15:43.380: e/androidruntime(795): @ android.os.looper.loop(looper.java:136) 06-30 01:15:43.380: e/androidruntime(795): @ android.app.activitythread.main(activitythread.java:5017) 06-30 01:15:43.380: e/androidruntime(795): @ java.lang.reflect.method.invokenative(native method) 06-30 01:15:43.380: e/androidruntime(795): @ java.lang.reflect.method.invoke(method.java:515) 06-30 01:15:43.380: e/androidruntime(795): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:779) 06-30 01:15:43.380: e/androidruntime(795): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:595) 06-30 01:15:43.380: e/androidruntime(795): @ dalvik.system.nativestart.main(native method)
i have mentioned in manifestfile,then facing problem..please help..
Comments
Post a Comment