Using this example (https://stackoverflow.com/a/9109728/2808099) I hooked up my database. But I did not get to organize the search in this database. I am trying to convey a request from the EditText and display the result in the textView (or ListView).
MainActivity
public void LoadAddress(View v)
{
searchAddress = editTextSearch.getText().toString();
TestAdapter mDbHelper = new TestAdapter(this);
mDbHelper.createDatabase();
mDbHelper.open();
Cursor testdata = mDbHelper.getTestData("SELECT * FROM Address " +searchAddress+"';", null);
String address=testdata.getString(1).toString();
textView.setText(address);
mDbHelper.close();
}
TestAdapter
public Cursor getTestData(String s, Object o)
{
try
{
String sql ="SELECT * FROM Address";
Cursor mCur = mDb.rawQuery(sql, null);
if (mCur!=null)
{
mCur.moveToNext();
}
return mCur;
}
catch (SQLException mSQLException)
{
Log.e(TAG, "getTestData >>"+ mSQLException.toString());
throw mSQLException;
}
}
Regardless of the content of the EditText, the first line of output from the database