我刚开始在android中开发,我正在尝试创建新布局并使用意图方法在旧布局和新布局之间连接,但我总是遇到错误,如果有人可以帮助我,我将不胜感激......
代码是:
package newapplication.com;
import org.w3c.dom.Text;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends Activity {
private Button b6;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b6 = (Button) findViewById(R.id.button6);
b6.setOnClickListener(next);
//Call to the next activity
OnClickListener next = new OnClickListener() {
@Override
public void onClick(View v) {
Intent myIntent = new Intent(MainActivity.this, MainActivity2.class);
startActivity(myIntent);
}
};
}
它总是写信告诉我下一个无法解析为变量