Android – AutoCompleteTextView using cursorloader

I'm changing my application to use cursorloader instead of startmanagingcursor

I have an implementation of AutoCompleteTextView, simplecursoradapter and my setfilterqueryprovider. In the "runquery" method, I have

    mProdutoAdapter.setFilterQueryProvider(new FilterQueryProvider() {
        @Override
        public Cursor runQuery(CharSequence constraint) {

            Cursor cursor = mVendasDb.getProdutos(constraint.toString());
            startManagingCursor(cursor);
            return cursor;
        }
    });

How do I change this subassembly to work with cursorloader?

Should I discard setQueryFilterProvider and use TextWatcher in AutocompleteTextView, then call getLoaderManager ().RestartLoader (0, bundleFilter, this)??? I don't know how to program!

Bundlefilter will have text from textcatcher

Can you use this method? In this case, is this the best?

resolvent:

According to the Android Developer website, this is a good way:

Restarting a Loader :

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>