0
我知道這個問題曾問過一次,但我沒有看到它從那時起的答案。因此,如果你有人可以在這方面指導我,我會很感激。Android AChartEngine圖位圖NullPointerException
Android need help with diagram
我有以下部分的錯誤:
double x = 0;
double y = 0;
for (int i=0;i<10;i++)
{
x=x+10;
y=y+5;
mCurrentSeries.add(x, y);
}
Log.i("Series Count",""+mCurrentSeries.getItemCount());
for (int xy=0;xy<10;xy++)
{
Log.i("Series -- Values","["+mCurrentSeries.getX(xy)+","+mCurrentSeries.getY(xy)+"]");
}
if (mChartView != null) {
mChartView.repaint();
}
Bitmap bitmap = mChartView.toBitmap();
try {
File file = new File(Environment.getExternalStorageDirectory(),
"test" + index++ + ".png");
OutputStream output = new FileOutputStream(file);
bitmap.compress(CompressFormat.PNG, 100, output);
output.flush();
output.close();
} catch (Exception e) {
Toast.makeText(LineChartTestActivity.this, "Graph Exception", Toast.LENGTH_LONG).show();//Added Toast to see exception on device
Log.e("ERROR", "BITMAP EXCEPTION");
e.printStackTrace();
}
具體地說下面的線給我顯示java.lang.NullPointerException
bitmap.compress(CompressFormat.PNG, 100, output);
像手持中提到他的問題,我也可以使用editText工作,但由於某些奇怪的原因,當我從代碼中提供明確的值時,它不會工作!
請指教。