Autocomplete text and SQLite
<p>There is a text field with Autocomplete text. Autocomplete goes diractly from the database. Autocomplete works correctly. For example, if you type "H", and there is "HONDA" in the database, then you will be prompted with a hint "HONDA". If you enter it in the database and there is nothing there, then nothing appears, and I need phrase "NO RESULTS" to be displayed. I can not figure out how to do it.
Hint works with this code. But there is no verification of results and display of the phrase "NO RESULTS" here, if there is no data to display. Could you be so kind as to explain how to add a check?</p>

<p>MainActivity.java:</p>

<pre><code>SearchCar = (AutoCompleteTextView) findViewById(R.id.SearchCar);

SQLiteCarAssistant = new SQLiteAssistant(MainActivity.this);
SQLiteCarAssistant.openDB();
String[] cars = SQLiteCarAssistant.getAll();

adapter = new ArrayAdapter&lt;String&gt;(this, R.layout.list_item,cars);
SearchCar.setAdapter(adapter);

SearchCar.addTextChangedListener(new TextWatcher() {
 public void afterTextChanged(Editable s) {

  MainActivity.this.adapter.getFilter().filter(s);
                                     }

  public void beforeTextChanged(CharSequence s, int start, int count, int after) {
                                         // Abstract Method of TextWatcher Interface.
                                     }

  public void onTextChanged(CharSequence s, int start, int before, int count) {
                                                   // Abstract Method of TextWatcher Interface.
                                     }
                                 });
</code></pre>

<p>SQLiteAssistant.java:   </p>

<pre><code>public String[] getAll(){
    Cursor cursor = this.sqliteDBInstance.query(DB_TABLE_NAME, new String[] {NAME}, null, null, null, null, null); 
    if(cursor.getCount() &gt; 0) {
       String[] str = new String[cursor.getCount()];
       int i = 0;
       while (cursor.moveToNext()){
           str[i] = cursor.getString(cursor.getColumnIndex(NAME));
           i++
       }
       return str;
    }
    else {
        return new String[] {};
    }
}
</code></pre>
