Note that there are some explanatory texts on larger screens.

plurals
  1. POPrevent AutoCompleteTextView from showing the result in its own box
    text
    copied!<p>I am using an AutoCompleteTextView to show a list of items the user can select. When the users selects an item, this selected item fills a ListView just below the AutoCompleteTextView. So far so good.</p> <p>The issue: after the selection of the item out of the AutoCompleteTextView, the AutoCompleteTextView body itself (this "text-box") gets filled up with some text, which is the SimpleCursorAdapter resource (the actual text showing up is: android.widget.SimpleCursorAdapter@4107d010).</p> <p>What I wish to have: I want the AutoCompleteTextView to refresh and show no text in its own body so the user can immediately type in more text and select further items out of the drop-down list. </p> <p>Could you please give me a hint how I could achieve that?</p> <p>Added information:</p> <p>Thank you Kyle. What I did was to extend SimpleCursorAdapter to SimpleCursorAdapterNoText. I then overridden convertToString() just like you said. I didn't change BindView because I read the documentation twice but I still don't understand what I should change in BindView. Any way - This didn't save the problem - I still get the same string in the AutoComplete. Here is my code:</p> <pre><code>@SuppressWarnings("deprecation") private void populateListView() { // Get all of the notes from the database and create the item list Cursor tournamentXCursor = mDbHelper.retrieveTrounamentX(mRowId); startManagingCursor(tournamentXCursor); // Create an array to specify the fields we want to display in the list (only name) String[] from = new String[] {StournamentConstants.TblX.TBL_COLUMN_X_NAME}; // and an array of the fields we want to bind those fields to (in this case just name) int[] to = new int[]{R.id.competitor_row}; // Now create an array adapter and set it to display using our row SimpleCursorAdapterNoText tournamentX = new SimpleCursorAdapterNoText(this, R.layout.competitor_row, tournamentXCursor, from, to); tournamentX.convertToString(tournamentXCursor); setListAdapter(tournamentX); } </code></pre> <p>Anyone has a clue what I am doing wrong?</p> <p>EDITED: This is my inherited SimpleCursorAdapter class</p> <pre><code> public class SimpleCursorAdapterNoText extends SimpleCursorAdapter { public SimpleCursorAdapterNoText(Context context, int layout, Cursor c, String[] from, int[] to) { super(context, layout, c, from, to); // TODO Auto-generated constructor stub } @Override public CharSequence convertToString(Cursor cursor) { //Empty string so AutoComplete shows no text return ""; } @Override public void bindView(View view, Context context, Cursor cursor) { // TODO Auto-generated method stub super.bindView(view, context, cursor); } } </code></pre> <p>I changed my calling code and eliminated </p> <pre><code>tournamentX.convertToString(tournamentXCursor); </code></pre> <p>I was convinced it is essential that I not only override it in my subclass but that I also use it in my calling code so the text inside the AutoComplete will be eliminated.</p> <p>I am sag to say the this still didn't help - I keep on getting android.database.sqlite.SQLiteCursor@41377578 in the AutoCompleteBox just after I select one item off the AutoComplete selection list.</p> <p>Thanks D.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload