发现错误

时间:2014-08-22 19:57:05

标签: android-activity

我得到的错误是"此行的多个标记      - 语法错误,插入"}"去完成      ClassBody      - 语法错误,插入&#34 ;;"去完成      声明      - 语法错误,插入")"去完成      表达" 仍然在同一条线上,我试过放置不同的")"和"}"并且他们只是让它变得更糟,甚至试图去除或移动它们仍然相同的问题..不能运行错误的原因

我的SignUp课程,

public  class SignUp extends Activity {
    private EditText reg_fullname, reg_username, reg_email, reg_password, reg_confirmpassword;
    private Button btnRegister;
    private LoginDataBaseAdapter dataBaseAdapter;
    private TextView loginScreen;
    protected DataBaseHelper DB = new DataBaseHelper(SignUp.this); 

@Override
     protected void onCreate(Bundle savedInstanceState) 
    {
    super.onCreate(savedInstanceState);
    // Set View to register.xml
    setContentView(R.layout.signup);


     reg_fullname = (EditText) findViewById(R.id.reg_fullname);
     reg_username = (EditText) findViewById(R.id.reg_username);
     reg_email = (EditText) findViewById(R.id.reg_email);
     reg_password = (EditText) findViewById(R.id.reg_password);
     reg_confirmpassword = (EditText) findViewById(R.id.reg_confirmpassword);

    loginScreen = (TextView) this.findViewById(R.id.link_to_login);
    //Listening to Login Screen Link
    btnRegister = (Button) findViewById(R.id.btnRegister);

    loginScreen.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {


      switch(v.getId()){

      case R.id.link_to_login:
          startActivity(new Intent(SignUp.this, LoginScreen.class));
            finish();
            break;

      case R.id.btnRegister:
        // I think they have to be final to be used in the onClickListener
            final String fullname = reg_fullname.getText().toString();
            final String username = reg_username.getText().toString();
            final String password = reg_password.getText().toString();
            final String email = reg_email.getText().toString();

            boolean invalid = false;

       if(fullname.equals(""))
       {
        invalid = true;
        Toast.makeText(getApplicationContext(), "Enter your Firstname", Toast.LENGTH_SHORT).show();
       }
       else


        if(username.equals(""))
        {
         invalid = true;
         Toast.makeText(getApplicationContext(), "Please enter your Username", Toast.LENGTH_SHORT).show();
        }
        else


          if(password.equals(""))
         {
          invalid = true;
          Toast.makeText(getApplicationContext(), "Please enter your Password", Toast.LENGTH_SHORT).show();

       }
         else 
          if(email.equals(""))
       {
        invalid = true;
        Toast.makeText(getApplicationContext(), "Please enter your Email ID", Toast.LENGTH_SHORT).show();
       }
         else
          if(invalid == false)
          {
           addEntry(fullname, username, password, email);
           Intent i_register = new Intent(SignUp.this, LoginScreen.class);
           startActivity(i_register);
           finish();

      }
      }
          break;
        } ****error appears here ***
    }
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
try{
        super.onDestroy();
    dataBaseAdapter.close();
}catch(Exception e){
       Log.e("onDestroy SignUp- Error", e.getMessage());
}}

private void addEntry(String fullname,  String username, String password, String email) 
 {

      SQLiteDatabase db = DB.getWritableDatabase();

      ContentValues values = new ContentValues();
      values.put("fullname", fullname);
      values.put("username", username);
      values.put("password", password);
      values.put("email", email);

      try
      {
       db.insert(DataBaseHelper.DATABASE_TABLE_NAME, null, values);

       Toast.makeText(getApplicationContext(), "your details submitted Successfully...", Toast.LENGTH_SHORT).show();
      }
      catch(Exception e)
      {
       e.printStackTrace();
      }


 }}

1 个答案:

答案 0 :(得分:0)

休息后需要以下符号;

      ...
      break;
    }
  });
}

@Override
protected void onDestroy() {