Android 在数据库中插入错误的值

Android 在数据库中插入错误的值,android,database,Android,Database,我已经编写了一个程序,在数据库中插入这些值。我记下了姓名、电话、地址和电子邮件,但数据库中只插入了姓名和电话。在地址和电子邮件列中,再次插入姓名和电话。 这是我的密码 edit_phone=(EditText)findViewById(R.id.phone); edit_name=(EditText)findViewById(R.id.name); edit_email=(EditText)findViewById(R.id.email); edi

我已经编写了一个程序,在数据库中插入这些值。我记下了姓名、电话、地址和电子邮件,但数据库中只插入了姓名和电话。在地址和电子邮件列中,再次插入姓名和电话。 这是我的密码

edit_phone=(EditText)findViewById(R.id.phone);
        edit_name=(EditText)findViewById(R.id.name);
        edit_email=(EditText)findViewById(R.id.email);
        edit_add=(EditText)findViewById(R.id.addr);
        String name1=edit_name.getText().toString();
        String mobile_no1=edit_phone.getText().toString();
        String email1=edit_name.getText().toString();
        String addr1=edit_phone.getText().toString();
        db.execSQL("insert into register values('"+name1+"','"+mobile_no1+"','"+email1+"','"+addr1+"')");
        edit_phone.setText(" ");
        edit_name.setText(" ");
        edit_email.setText(" ");
        edit_add.setText(" ");
        db.close();
改变

    String email1=edit_name.getText().toString();
    String addr1=edit_phone.getText().toString();


以下是您的问题所在:

String email1=edit_name.getText().toString();
String addr1=edit_phone.getText().toString();

您正在将姓名存储在电子邮件变量中,将电话存储在地址变量中。

请使用ContentProvider
String email1=edit_name.getText().toString();
String addr1=edit_phone.getText().toString();