我正在编写我的第一个应用程序,我是编程新手......这个程序正在进行中,但我想看看它到目前为止的样子,如果我能编译它!我认为括号有问题,每次我修复一个错误时,另一个错误就会出现在其他地方......有没有一种简单的方法来发现丢失的括号?谢谢!
package com.Jenko.votingapp;
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import android.content.Intent;
public class MainActivity extends Activity {
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button createNew = (Button)findViewById(R.id.newPoll);
createNew.setOnClickListener(new View.OnClickListener() {
public void onClick (View view) {
startActivityForResult(new Intent("com.Jenko.votingapp.CREATENEWPOLL"), 1);
finish();
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode ==1) {
if (resultCode == RESULT_OK) {
//something will eventually happen here...
}
Button seePrevious = (Button)findViewById(R.id.prevPoll);
seePrevious.setOnClickListener(new View.OnClickListener() {
public void onClick (View view) {
startActivityForResult(new Intent("com.Jenko.votingapp.SEEPREVIOUSPOLL"), 2);
finish();
}
});
}