0

I want to make a simple AutoCompleteTextview where there will be auto suggestion of mobile numbers while user typing. I did something like following

    public class MainActivity extends AppCompatActivity {

        String dummyNumbers[] = {"01912953698","01912963698","01912963798","01712963698",
            "01716581932","01716581931","01716582931","01837338077","01837338078"};

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);

            AutoCompleteTextView edittext = (AutoCompleteTextView) findViewById(R.id.auto_suggestion);
            ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(this,android.R.layout.simple_list_item_1,dummyNumbers);
            edittext.setAdapter(arrayAdapter);
    }
}

It works fine.

Now my question is if i have a database of 1 millions of mobile number data and I query those numbers then store them to my 'dummyNumbers' array variable, will it be efficient?

In common sense, storing 1 millions data in an array at runtime obviously is high memory consumption.

Is there any efficient way of what I wanting to do or storing 1M data and making operation on them won't create any problem (android will somehow handle that in background).

SHB
  • 585
  • 6
  • 14

0 Answers0