私はJavaとアンドロイドの新機能です。キャンバスとペイントを使用して私の最初のアプリ。私はdrawTextメソッドを使用しようとすると何らかの理由でクローズするようになります。助けてください。 私は基本的に特定のx、y座標でテキストを表示しようとしています。ゲームプレイ中に更新が必要な場合は、私のコード:drawTextキャンバスメソッドが動作しない
public class MyGame extends Main {
TextView timeDisplay;
public String clock;
int x_pos = 10;
int y_pos = 100;
int radius = 20;
float x = 10;
float y = 20;
android.graphics.Paint p;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// setup Drawing view
Bitmap b = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
c.drawText("test", 30, 0,x,y, p); <-- if I comment this out, no force close...
あなたのご協力ありがとうございます。