-1

最初のautocompletetextviewデータをデータベースからフェッチし、2番目のautocompletetextviewで最初のautocompletetextviewに関連するデータのみが必要な2つのautocompletetextviewを使用しているアプリを開発しています。データベースに 3 つの列があり、1 つの列が最初の autocomlepettextview にリンクされている場合、列 2 のデータのみが表示され、列で選択されている必要があります。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[] {};
        }
4

1 に答える 1

0

アプリを構築している環境がわからないので、Web アプリであると仮定します。

あなたが求めているのは「カスケード オートコンプリート」と呼ばれるものです。コードの例を次に示します。

http://www.webdeveasy.com/cascading-autocompletes-using-jquery-ui/

于 2013-03-14T19:10:24.997 に答える