在我的 Android 应用程序中,我有两个活动类。我在第一个按钮上有一个按钮,我想在单击它时显示第二个按钮,但出现错误。以下是课程:
public class SplashActivity extends Activity {
Button b;
@Override
public void onCreate(Bundle bun) {
// TODO Auto-generated method stub
super.onCreate(bun);
setContentView(R.layout.splash);
b=(Button)findViewById(R.id.skipp);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// TODO Auto-generated method stub
startActivity (new Intent(SplashActivity.this, MCActivity.class));
}
});
}
@Override
protected void onPause()
{
// TODO Auto-generated method stub
finish();
}
}
二等:
public class MCActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
我已经添加了
<activity android:name=".MCActivity" />
在清单中,在<application>
标签内......
当我单击按钮 b 时,运行时错误活动仍然意外停止。