我正在开发应用程序,其中我使用两个 autocompletetextview,其中第一个 autocompletetextview 数据是我从数据库中获取的,而在第二个 autocompletetextview 中,我只想要那些与第一个 autocompletetextview 相关的数据。意味着如果数据库中有 3 列,并且 1 列链接到第一个 autocomlepettextview,那么只有第 2 列中的那些数据必须是可见的,这些数据在 column 中被选中。public String[] getSymptom() { Cursor cursor = this.sqliteDBInstance.query(DB_TABLE_NAME, new String[] {COLUMN_2_Symptom}, null, null, null, null, null);
if(cursor.getCount() >0)
{
str = new String[cursor.getCount()];
int i = 0;
while (cursor.moveToNext())
{
str[i] = cursor.getString(cursor.getColumnIndex(COLUMN_2_Symptom));
i++;
}
return str;
}
else
{
return new String[] {};
}
}
public String[] getSymptom1() {
// TODO Auto-generated method stub
String[] clmn=new String[]{COLUMN_3_Symptom1};
Cursor curs=this.sqliteDBInstance.query(DB_TABLE_NAME,clmn ,"Symptom = ?",new String[]{COLUMN_2_Symptom},null,null,null);
//Cursor curs=this.sqliteDBInstance.rawQuery("Select Symptom1 from Diseaseslist where Symptom='" + + "' ", null);
if(curs.getCount()>0)
{
str1 = new String[curs.getCount()];
int j= 0;
while(curs.moveToNext())
{
str1[j] = curs.getString(curs.getColumnIndex(COLUMN_3_Symptom1));
j++;
}
return str1;
}
else
{
return new String[] {};
}