0

How would I go about making it so when you click on a button it would take the value of EditText1 and EditText 2 than check a database to see if they match and if they do it should saying success.

This is just for testing, I just want to learn how to do this.

This is my code so far, I'm just not sure how to do the whole database part.

    final Button button1 = (Button) findViewById(R.id.Button01);
    button1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            EditText text1 = (EditText) findViewById(R.id.editText1);
            EditText text2 = (EditText) findViewById(R.id.EditText01);
        }
    });
}
user2839430
  • 123
  • 1
  • 2
  • 8

1 Answers1

0

Try this :

{

str1 = editText1.getText.toString();

str2 = editText2.getText.toString();

}

{

cursor c = db.query(select all ids);

while(c.moveToNext){

if(c.getId() == str1 && c.getId() == str2)

{

do sumthing

}

}

}