AutoCompleteTextView入力した最初の 4 文字に従って、DB で見つかったすべての町 (ville) を提供する an を管理します。
はAsync taskうまく機能し、適切なデータを取得します。
私の問題は、DropDownListすべてのアイテムが表示されないことです。多くの場合、DB によって返される 20 のうち 1、2、3、または 4 つだけです。
そこで、ACTV 自体に自動フィルタリングが必要であることがわかりました。ここでSOに関する多くのトピックをチェックして、コードを更新しましたが、成功しませんでした.... :-(
何が問題なのか正確にわからないまま、エラーが発生し続けます。:-(
だからここに私のコードがあります:
class MyActivity extends Activity implements AdapterView.OnItemClickListener
{
        static class Ville 
        {
            String id;
            String name;
            @Override
            public String toString() { return this.name; }
        };
        ArrayAdapter<Ville>    villeAdapter;
        String                 villeAdapterFilter;
        VilleUpdateTask        villeAdapterUpdateTask;
        AutoCompleteTextView   villeText;
        Ville                  selectedVille;
        final TextWatcher textChecker = new TextWatcher() {
            public void afterTextChanged(Editable s) {}
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
            public void onTextChanged(CharSequence s, int start, int before, int count)
            { 
                  MyActivity.this.setAdapterFilter(s.toString());
            }
        };
        public void onCreate(Bundle bundle)
        {
             super.onCreate(bundle);
             setContentView(R.layout.main);
             this.villeAdapter = new ArrayAdapter<Ville>(this,android.R.layout.simple_dropdown_item_1line, new Ville[0]);
             this.villeText = (AutoCompleteTextView ) findViewById(R.id.villeSelector);
             this.villeText.setAdapter(this.villeAdapter);
             this.villeText.setThreshold(THRESHOLD_DROPDOWN); 
             this.villeText.setOnItemClickListener(this);
             this.villeText.addTextChangedListener(textChecker);
        }
        public void onDestroy() { stopVilleAdapterUpdate(); 
        public void setAdapterFilter(String filter)
        {
             if (filter == null) {
                 // clearing the adapter
                 this.villeAdapterFilter = null;
                 this.villeAdapter.clear();
                 this.villeAdapter.notifyDataSetChanged();
                 Log.d("MyActivity","Clearing ville filter !");
             } else if (filter.length() > THRESHOLD_QUERY) {
                  if (this.villeAdapterFilter == null) {
                      Log.d("MyActivity","Ville Adapter Filter defined to:"+filter);
                      this.villeAdapterFilter = filter;
                      startVilleAdapterUpdate();
                  } else {
                      Log.d("MyActivity","Already filtered with:"+this.villeAdapterFilter);
                  }
             } else {
                  Log.d("MyActivity","Resetting filter (not enough data)");
                  this.villeAdapterFilter = null;
                 this.villeAdapter.clear();
                 this.villeAdapter.notifyDataSetChanged();
             }
        }
        public synchronized void onItemClick(ViewAdapter<?> ad, View v, int position, long id)
        {
             this.selectedVille = this.villeAdapter.getItemAtPosition(position);
             Log.d("MyActivity","Ville selected: "+this.selectedVille);
        }
        public synchronized void startVilleAdapterUpdate()
        {
              stopVilleAdapterUpdate();
              Log.d("MyActivity","Starting Update of Villes with "+this.villeAdapterFilter);
              this.villeAdapterUpdateTask = new VilleUpdateTask();
              this.villeAdapterUpdateTask.execute(this.villeAdapterFilter);
        }
        public synchronized void stopVilleAdapterUpdate()
        {
             if (this.villeAdapterUpdateTask != null) {
                 Log.d("MyActivity","Stopping current update of villes");
                 this.villeAdapterUpdateTask.cancel(true);
                 this.villeAdapterUpdateTask = null;
             }
        }
        public synchronized void onVilleAdapterUpdateResult(Ville[] data)
        {
             this.villeAdapterUpdateTask = null;
             if (data != null) {
                 Log.d("MyActivity","Received "+data.length+" villes from update task");
                 this.villeAdapter.clear();
                 this.villeAdapter.addAll(data);
                 this.villeAdapter.notifyDataSetChanged(); // mise à jour du drop down...
            }
        } 
        class VilleUpdateTask extends AsyncTask<String,Void,Ville[]>
        {
              public Ville[] doInBackground(String ... filters)
              {
                  ArrayList<Ville> values = new ArrayList<Ville>();
                  try  {
                       HttpClient httpclient = new DefaultHttpClient();
                       ....
                       ....
                       for(int i=0;i<json_array.length();i++) {
                           JSONObject json_ligne = json_array.getJSONObject(i);   
                           try {
                               Ville v = new Ville();
                               v.name = json_ligne.getString("NAME_VILLE");
                               v.id = json_ligne.getString("ID_VILLE");
                               values.add(v);
                           } catch (Exception ex) {
                               Log.w("VilleUpdateTask","Invalid value for Ville at index #"+i,ex);
                           }
                       }
                  } catch (Exception ex) {
                       Log.e("VilleUpdateTask","Failed to retrieve list of Ville !",ex);
                  }
                  return values.toArray(new Ville[values.size()]);
             }
             public void onPostExecute(Ville[] data)
             {
                 MyActivity.this.onVilleAdapterUpdateResult(data);
             }
        }
}
EDIT 1:はい、申し訳ありませんが、私の ACTV は基本的なTextView です。スクロールの問題ではありません。より良いケースでは、リストに10個のアイテムが表示され、最後の位置がランダムであるためです
編集 2: 既存のコードを上記の 2 つの URL からの特定のソリューションに適応させるのを手伝っていただけませんか?
(1)そのソリューションに従ってAutoCompleteTextView - フィルタリングを無効にする
私はしなければならない:
- 指定されたものと同じクラスClassMyACArrayAdapterを作成します。名前のみが変更されます 
- から私の宣言を変更します - ArrayAdapter villeAdapter; 
に
List<ClassMyACArrayAdapter> villeAdapter;
- しかし、 onCreate では、最初のものを何に置き換える必要がありますか - this.villeAdapter = new ArrayAdapter 
 (this,android.R.layout.simple_dropdown_item_1line, new Ville[0]);