【发布时间】:2015-08-23 22:20:53
【问题描述】:
我不确定为什么这没有得到我的图像。这是我第一次使用 java 使用 android 应用程序,所以不知道该怎么做。
public class Player {
private GameView view;
private Bitmap bmp;
public int x, y;
public Player(GameView view) {
this.view = view;
}
public void tick() {
//This is my error here//
bmp = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
}
public void onDraw(Canvas c) {
c.drawBitmap(bmp, x, y, null);
}
}
尝试将 bmp 设置为我希望它在 getResources() 的刻度方法中的值时出现错误。我不知道为什么 getResources() 是错误的。
谢谢
【问题讨论】:
标签: android bitmapfactory