• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Link with SQL in android

When i retrieve Data from Sqlite Database and show the values in textview for the matching criteria, there are two results, bu both are show in same textview itself, i have to show them in seperate textview.


This is the code using for searching in database....


public String getAddress(String autocomplete)
{
c=db.rawQuery("select ID,Mobile from Employee_Master where NAME = '"+autocomplete+"'", null);
StringBuffer buffer = new StringBuffer();
while(c.moveToNext()){
String ID=c.getString(0);
String Mobile=c.getString(1);
buffer.append(""+ID+Mobile);

}
return buffer.toString();

}


This Code is to search the the input values when Button is slicked

button3.setOnClickListener(new View.OnClickListener() {

@override
public void onClick(View view) {
DBCreate databaseAccess = DBCreate.getInstance(getApplicationContext());

databaseAccess.open();

String n = autocomplete.getText().toString();
String ID = databaseAccess.getAddress👎;
String Mobile = databaseAccess.getAddress👎;

textView3_result.setText(String ID);
textView4_result.setText(String Mobile);

databaseAccess.close();
}

});



The Picture attached is the output which i get.
 

Attachments

  • Untitled.png
    Untitled.png
    45.8 KB · Views: 107
Back
Top Bottom