Skift din kode for at indsætte Edittext-værdier i databasen ved knapklik:
public class DatabaseActivity extends Activity {
DBAdapter db;
Button submitbtn;
EditText edit1,edit2,edit3;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_database);
db=new DBAdapter(this);
submitbtn = (Button) findViewById(R.id.submit);
edit1 = (EditText) findViewById(R.id.edit1);
edit2 = (EditText) findViewById(R.id.edit2);
edit3 = (EditText) findViewById(R.id.edit3);
db.open();
submitbtn.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
String steedtone=edit1.getText().toString();
String steedttwo=edit2.getText().toString();
String steedtthree=edit3.getText().toString();
long result=db.insertTitle(steedtone,steedttwo,steedtthree);
}
});
}
}