添加數據我有一個AutoCompleteTextView當我靜態定義我的字符串這樣的工作正常..AutoCompleteTextView不能正常工作從數據庫
private String Names[] = {"Hassan", "Usman", "Kristen Stewart"};
那麼我這樣做..
ArrayAdapter<String> adapter = new ArrayAdapter<String>
(this, android.R.layout.select_dialog_item, Names);
//Getting the instance of AutoCompleteTextView
catgNames.setThreshold(0);//will start working from 0 character
catgNames.setAdapter(adapter);//setting the adapter data into the AutoCompleteTextView
但當我嘗試從加載一些數據Sqlite,下拉蘇通氣不起作用。我在做這樣的事情..
Categories = new String[100]
int i =0;
DatabaseHandler db = new DatabaseHandler(this);
List<entries> entries1 = db.getCategories();
for (entries cn : entries1) {
Log.i("", cn.getCategories());
Names[i] = cn.getCategories();
i++;
}
並在此之後,我定義的適配器..
ArrayAdapter<String> adapter = new ArrayAdapter<String>
(this, android.R.layout.select_dialog_item, Names);
//Getting the instance of AutoCompleteTextView
catgNames.setThreshold(0);//will start working from 0 character
catgNames.setAdapter(adapter);//setting the adapter data into the AutoCompleteTextView
這是行不通的。沒有任何錯誤或登錄貓警告..
檢查的解決方案是它分貝數據無濟於事或不。 – HassanUsman
我做了..它在那裏..如果那會是這種情況,那麼我會很容易解決它。 –
檢查我的答案 – HassanUsman