我有以下活动
public class BmiHistory extends Activity {
public Cursor cursor;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.bmihistory);
final DatabaseHandler databaseOpen = new DatabaseHandler(this);
final SQLiteDatabase db = databaseOpen.getReadableDatabase();
Cursor c1 = db.rawQuery("select * from bmi", null);
startManagingCursor(c1);
c1.moveToFirst();
this.cursor = c1;
while(!c1.isAfterLast()) {
System.out.println(c1.getString(2));
c1.moveToNext();
}
c1.close();
BmiGraph drawView = new BmiGraph(this);
drawView.setBackgroundColor(Color.WHITE);
setContentView(drawView);
}
}
我从这个活动中调用了以下课程
public class BmiGraph extends View {
Paint paint = new Paint();
public BmiGraph(BmiHistory context) {
super(context);
// TODO Auto-generated constructor stub
System.out.println(context.toString());
}
public void onDraw(Canvas canvas) {
paint.setColor(Color.BLACK);
paint.setStrokeWidth(3);
...
}
}
我的问题是如何将 Activity 中光标的数据提供给第二类以绘制图表?
非常感谢