D.D.M.
D.D.M.

Reputation: 127

Create adapter from array(AutoCompleteTextView)

help me please with set adapter for AutoCompleteTextView

MyCode:

arr = getResources().getStringArray(R.array.site_array);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(
     MainActivity.this, android.R.layout.simple_dropdown_item_1line,arr);
url_str.setAdapter(adapter);`

When i try set array with loop normally filled and not empty Autocomplete results do not appear.

for(int i=0;i<100;i++)
{
   arr[i] = Utils.getHost(History.getLinkElementFromIndex(MainActivity.this,i));
   Log.v("TEST_1",arr[i]);
}

ArrayAdapter<String> adapter = new ArrayAdapter<String>(
     MainActivity.this, android.R.layout.simple_dropdown_item_1line,arr);
url_str.setAdapter(adapter);

Upvotes: 1

Views: 168

Answers (1)

D.D.M.
D.D.M.

Reputation: 127

I find Answer. You can't create ArrayAdapter with 1000+ strings in array. Maximal string count == 500. This works for me good.

Upvotes: 2

Related Questions