My wanna do the search thing on my app, and I'm using a AutoCompleteTextView that use more than one string-array stored on resources, I'm doing this way:
List<String> list = new ArrayList<>();
String[] array1 = getResources().getStringArray(R.array.array1);
String[] array2 = getResources().getStringArray(R.array.array2);
...
list.addAll(Arrays.asList(array1));
list.addAll(Arrays.asList(array2));
...
AutoCompleteTextView autoView = (AutoCompleteTextView) findViewById(R.id.auto_complete);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, list);
autoView.setAdapter(adapter);
It works nicelly, but I'm in doubt when performance and memory of my app, 'cause are many itens on each array (altogether more than 400), so I'm wondering if create a list to add all itens (like I'm doing) can take up too much memory? This way I'm doing is wrong or it's right? Can harm the app performance?
Anyone knows?
Thx
It doesn't create much problem. It just consume a little memory. I am using approx 8000 items in the list with Auto Complete TextView, Which works fine for me. If you are worried about this thing, just check your memory usage on device monitor with the both cases. You can do this like this:
Hope this will help.