开发者

Problem Switching from TableLayoutView Activity to GLSurfaceView Activity

I have an issue going from my current TableLayoutView based activity to a GLSurfaceView based activity. Whenever I try to switch the intents and start a new activity, my app crashes. I've already registered the activity in the manifest. I have one onClickListener in each activity, waiting for a specific click.

code for class 1:

public void onClick(View v) {
  // TODO Auto-generated method stub
    Intent myIntent = new Intent();
    myIntent.setClassName("foo.ba开发者_如何学Gor.thud", "foo.bar.thud.RotatingCube");
    Catalog.this.startActivity(myIntent);
}

code for class 2:

public void onClick(View v) {
    // TODO Auto-generated method stub
    Intent myIntent = new Intent();
    myIntent.setClassName("foo.bar.thud", "foo.bar.thud.Catalog");
    startActivity(myIntent);
}


Generally using the class objects themselves is less error-prone:

Intent intent = new Intent(Catalog.this, RotatingCube.class);
Catalog.this.startActivity(intent);

and similar for the other class.

This way the compiler can check that the class you reference actually exists.

If this doesn't fix things, then try looking in logcat for the error message.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜