android - achartEngine. simple example -
i'm creating simple graphic achartengine, breaks following error activity , don't why:
here activity code, accessed buttom in previous activity.
import org.achartengine.chartfactory;
import org.achartengine.graphicalview;
import org.achartengine.model.xymultipleseriesdataset;
import org.achartengine.renderer.xymultipleseriesrenderer;
import android.content.context;
import android.support.v7.app.actionbaractivity;
import android.widget.linearlayout;
public class startactivity extends actionbaractivity {
private graphicalview mchartview; private xymultipleseriesdataset dataset; private xymultipleseriesrenderer renderer;
protected void onresume() { super.onresume();
if (mchartview == null) { linearlayout layout = (linearlayout) findviewbyid(r.id.linearlayout1); context context=getapplication(); mchartview = chartfactory.getbarchartview(context,dataset, renderer); layout.addview(mchartview); } else { mchartview.repaint(); } } }
and xml code:
relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/degradado" android:orientation="vertical" >
<linearlayout android:id="@+id/linearlayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@+id/drugs" android:layout_margin="10dp" android:orientation="vertical" > </linearlayout> <spinner android:id="@+id/drugs" android:layout_width="96dp" android:layout_height="wrap_content" android:layout_alignright="@+id/patient_data" android:layout_below="@+id/patient_data" android:layout_margintop="12dp" android:hint="drugs" android:text="drugs" /> <button android:id="@+id/doctor_data" style="?android:attr/buttonstylesmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/drugs" android:layout_alignright="@+id/linearlayout1" android:layout_marginright="60dp" android:text="doctor data" /> <button android:id="@+id/patient_data" style="?android:attr/buttonstylesmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_marginright="51dp" android:layout_toleftof="@+id/start" android:text="patient data" /> <togglebutton android:id="@+id/onoff" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignright="@+id/doctor_data" android:layout_aligntop="@+id/drugs" android:layout_marginright="14dp" android:text="togglebutton" android:onclick="ontoggleclicked"/>
Comments
Post a Comment