这是我的程序。
public class MathsExplorer extends Activity {
/** Called when the activity is first created. */
private GraphicsView view;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(view);
}
}
public class GraphicsView extends View {
public GraphicsView(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
public void onDraw(Canvas canvas)
{
super.onDraw(canvas);
String background = "/Maths Explorer/bin/res/drawable/MC900436279.jpg";
Bitmap b = BitmapFactory.decodeFile(background);
canvas.drawBitmap(b, 10, 10, null);
}
}
它立即退出并显示错误“不幸的是,Maths Explorer 已停止。”
谁能帮我?我不确定,我只是想显示一个图像。