0
나는 게임을 시작하는 버튼을 만듭니다. AVD에서 해당 버튼을 클릭 할 때마다 불행히도 프로그램이 중단되고 Android 프로그래밍에 익숙하지 않습니다. 내 문제를 인터넷 검색을 시도하고 거기에 뭔가 코드가 잘못된 것 같습니다. 누구든지 나를 도울 수 있습니까? 나는 또한, 내 코드에 링크를 공유하는 주요 활동을 https://www.dropbox.com/sh/hyitjbgda69rkd4/3Iz8WuM5-5프로그램이 AVD에서 중지되었습니다
public class MainActivity extends Activity
{
private Game game1;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button button = (Button) findViewById(R.id.startbutton);
button.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
// Perform action on click
game1 = new Game(this);
setContentView(game1);
}
});
}
}
게임 클래스를 방문하십시오
public Game(OnClickListener onClickListener)
{
super((Context) onClickListener);
caneta = new Paint();
this.caneta.setARGB(255, 0, 0, 0);
this.caneta.setAntiAlias(true);
this.caneta.setStyle(Style.STROKE);
this.caneta.setStrokeWidth(5);
l = this.getWidth();
a = this.getHeight();
singlesquare = new Cell[x][y];
int xss = l/x;
int yss = a/y;
for (int z = 0; z < y; z++)
{
for (int i = 0; i < x; i++)
{
singlesquare[z][i] = new Empty(xss * i, z * yss);
}
}
}
post logcat error –