0

各グラフを実行すると、次のエラーが発生します

エラーログ:

10-25 06:00:46.555: E/AndroidRuntime(1307): FATAL EXCEPTION: main
10-25 06:00:46.555: E/AndroidRuntime(1307): java.lang.IllegalStateException: Could not     execute method of the activity

次に、eroor ログを表示します。

10-25 06:00:46.555: E/AndroidRuntime(1307): Caused by: java.lang.reflect.InvocationTargetException
10-25 06:00:46.555: E/AndroidRuntime(1307): at java.lang.reflect.Method.invokeNative(Native Method)
10-25 06:00:46.555: E/AndroidRuntime(1307): Caused by: java.lang.NoClassDefFoundError: org.achartengine.model.CategorySeries
10-25 06:00:46.555: E/AndroidRuntime(1307): at com.example.graph.PieGraph.getIntent(PieGraph.java:18)
10-25 06:00:46.555: E/AndroidRuntime(1307): at com.example.graph.MainActivity.pieGraphHandler(MainActivity.java:31)

円グラフのクラスは次のとおりです。

パッケージcom.example.graph;

import org.achartengine.ChartFactory;
import org.achartengine.model.CategorySeries;
import org.achartengine.renderer.DefaultRenderer;
import org.achartengine.renderer.SimpleSeriesRenderer;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;

public class PieGraph {

public Intent getIntent(Context context)
{
    int[] values = {1,2,3,4,5};

    CategorySeries series = new CategorySeries("Pie Graph");
    int k = 0;
    for(int value: values) {
        series.add("Section " + ++k, value);
    }

    int[] colors = new int[] {Color.BLUE, Color.GREEN, Color.MAGENTA, Color.YELLOW, Color.CYAN};

    DefaultRenderer renderer = new DefaultRenderer();
    for(int color: colors) {
        SimpleSeriesRenderer r = new SimpleSeriesRenderer();
        r.setColor(color);
        renderer.addSeriesRenderer(r);
    }

    Intent intent = ChartFactory.getPieChartIntent(context, series, renderer, "Pie");
    return intent;
}
}

主な活動は次のとおりです。

package com.example.graph;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

public void lineGraphHandler(View view) {
    LineGraph line = new LineGraph();
    Intent lineIntent = line.getIntent(this);
    startActivity(lineIntent);

}
public void barGraphHandler(View view) {
    BarGraph bar = new BarGraph();
    Intent lineIntent = bar.getIntent(this);
    startActivity(lineIntent);

}
public void pieGraphHandler(View view) {
    PieGraph pie = new PieGraph();
    Intent lineIntent = pie.getIntent(this);
    startActivity(lineIntent);

}
public void scatterGraphHandler(View view) {
    ScatterGraph scatter = new ScatterGraph();
    Intent lineIntent = scatter.getIntent(this);
    startActivity(lineIntent);

}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}
}

achartengine の jar ファイルを achartengine-1.1.0.jar としてプロジェクトに追加し、 AndroidManifest.Xml にも追加しました。

 <activity android:name="org.achartengine.GraphicalActivity"></activity>

折れ線グラフ、棒グラフ、散布図、円グラフの各グラフをクリックすると、同じタイプのエラーが表示されます。誰でもここで何が問題なのか教えてもらえますか? 何をすべきか?

4

1 に答える 1