1
我正在使用achartengine
繪製圖表,在將新值插入數據庫時將更新圖表。與數據庫整合時的achartengine問題
chart()
{
if (mChartView == null)
{
d = new BuildMultipleDataset();
db.open();
//code for some database query
LinearLayout layout = (LinearLayout) findViewById(R.id.chart);
mChartView = ChartFactory.getLineChartView(this, d.datasetbuilder(cursor1,cursor2), d.render());
layout.addView(mChartView, new LayoutParams(LayoutParams.FILL_PARENT, chartHeight));
db.close();
}
else
{
mChartView.repaint();
}
}
我從數據庫觸發更新時調用此方法。在那段時間,我讓mChartView = null;但問題是它沒有繪製更新的圖表。只有當我切換屏幕方向時,更新纔會反映到圖表中。我的代碼有什麼問題