不幸的是,应用程序停止了GraphView

时间:2014-07-07 12:09:35

标签: java android android-layout android-graphview

在运行时它显示致命异常并且还提供java.lang.NoClassFound异常。 我该如何运行此代码。

下面给出了XML和Activity classess。 请帮助我们.......

在Eclipse中它没有显示任何错误但是当我运行应用程序时,“不幸停止工作”。

XML LayOut文件

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/layout" >

</LinearLayout>

申请的主要活动

package com.example.graphview1;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.LinearLayout;

import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.GraphView.GraphViewData;
import com.jjoe64.graphview.GraphViewSeries;
import com.jjoe64.graphview.LineGraphView;

public class MainActivity extends Activity {

    LinearLayout layout;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        layout = (LinearLayout) findViewById(R.id.layout);
        GraphViewSeries exampleSeries = new GraphViewSeries(new GraphViewData[] {  
                  new GraphViewData(1, 40)  
                  , new GraphViewData(2, 12)  
                  , new GraphViewData(3, 7)
                  , new GraphViewData(2, 8)
                  , new GraphViewData(2, 10)
                  , new GraphViewData(3, 26)
                  , new GraphViewData(1, 37)
                  , new GraphViewData(1, 53)
                  , new GraphViewData(3, 253)

            });  

            GraphView graphView = new LineGraphView(  
                  this // context  
                  , "Job Status Graph" // heading  
            );  
            graphView.addSeries(exampleSeries); // data  

            layout.addView(graphView);  
    }
}

0 个答案:

没有答案