我刚刚开始学习如何编写 android 应用程序,而且我是一个完整的菜鸟。我不知道如何解决这个问题!请帮忙!格式可能看起来很糟糕......这是因为我不知道我在做什么!
package com.smiggle.bmxhandbook;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.content.Intent;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
Button button;
public void onCreate1(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
addListenerOnButton();
}
public void addListenerOnButton() {
button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener() {
public void onClick1(View arg0) {
Intent myIntent = new Intent(MainActivity.this, Trick.class
MainActivity.this.startActivity(myIntent);
}
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub; }
}
它不断给我一个语法错误!