Привет, я пытаюсь использовать библиотеку GraphView от JJOE64, я импортировал файл .jar в свой проект, используя eclipse «Добавить внешние архивы».Библиотека графического интерфейса JJOE64
Я создал новый объект GrapVew
package com.example.graphtest;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import com.jjoe64.graphview.*;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@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;
}
GraphView Grafico = new LineGraphView(this, "GraphTest");
}
и я играл приложение, чтобы увидеть, что происходит, и я получил эту фатальную ошибку
03-03 15:22:11.863: E/Trace(1048): error opening trace file: No such file or directory (2)
03-03 15:22:12.063: D/AndroidRuntime(1048): Shutting down VM
03-03 15:22:12.083: W/dalvikvm(1048): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
03-03 15:22:12.093: E/AndroidRuntime(1048): FATAL EXCEPTION: main
03-03 15:22:12.093: E/AndroidRuntime(1048): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.graphdraw/com.example.graphdraw.MainActivity}: java.lang.NullPointerException
03-03 15:22:12.093: E/AndroidRuntime(1048): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
03-03 15:22:12.093: E/AndroidRuntime(1048): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-03 15:22:12.093: E/AndroidRuntime(1048): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-03 15:22:12.093: E/AndroidRuntime(1048): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-03 15:22:12.093: E/AndroidRuntime(1048): at android.os.Handler.dispatchMessage(Handler.java:99)
03-03 15:22:12.093: E/AndroidRuntime(1048): at android.os.Looper.loop(Looper.java:137)
03-03 15:22:12.093: E/AndroidRuntime(1048): at android.app.ActivityThread.main(ActivityThread.java:5041)
03-03 15:22:12.093: E/AndroidRuntime(1048): at java.lang.reflect.Method.invokeNative(Native Method)
03-03 15:22:12.093: E/AndroidRuntime(1048): at java.lang.reflect.Method.invoke(Method.java:511)
03-03 15:22:12.093: E/AndroidRuntime(1048): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-03 15:22:12.093: E/AndroidRuntime(1048): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-03 15:22:12.093: E/AndroidRuntime(1048): at dalvik.system.NativeStart.main(Native Method)
03-03 15:22:12.093: E/AndroidRuntime(1048): Caused by: java.lang.NullPointerException
03-03 15:22:12.093: E/AndroidRuntime(1048): at android.content.ContextWrapper.getResources(ContextWrapper.java:89)
03-03 15:22:12.093: E/AndroidRuntime(1048): at android.view.ContextThemeWrapper.getResources(ContextThemeWrapper.java:78)
03-03 15:22:12.093: E/AndroidRuntime(1048): at android.view.View.<init>(View.java:3226)
03-03 15:22:12.093: E/AndroidRuntime(1048): at android.view.ViewGroup.<init>(ViewGroup.java:420)
03-03 15:22:12.093: E/AndroidRuntime(1048): at android.widget.LinearLayout.<init>(LinearLayout.java:168)
03-03 15:22:12.093: E/AndroidRuntime(1048): at com.jjoe64.graphview.GraphView.<init>(GraphView.java:258)
03-03 15:22:12.093: E/AndroidRuntime(1048): at com.jjoe64.graphview.LineGraphView.<init>(LineGraphView.java:20)
03-03 15:22:12.093: E/AndroidRuntime(1048): at com.example.graphdraw.MainActivity.<init>(MainActivity.java:27)
03-03 15:22:12.093: E/AndroidRuntime(1048): at java.lang.Class.newInstanceImpl(Native Method)
03-03 15:22:12.093: E/AndroidRuntime(1048): at java.lang.Class.newInstance(Class.java:1319)
03-03 15:22:12.093: E/AndroidRuntime(1048): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
03-03 15:22:12.093: E/AndroidRuntime(1048): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
03-03 15:22:12.093: E/AndroidRuntime(1048): ... 11 more
03-03 15:22:15.763: I/Process(1048): Sending signal. PID: 1048 SIG: 9
Спасибо за помощь.
Работы! Спасибо за помощь, а также за подсказку библиотеки. –