AsyncTask's get() method: Is there any scenario where it is actually the best option?

后端 未结 9 529
臣服心动
臣服心动 2020-12-14 02:31

After answering this question, I got a doubt about the sense/usefulness of using the get() method of Android\'s AsyncTask class.

public final Result get ()
         


        
9条回答
  •  隐瞒了意图╮
    2020-12-14 03:08

    You can use it in your AutoCompleteTextView's adapter's filter.

    private class Adapter extends BaseAdapter implements Filterable{
        getFilter(){
            return new Filter() {
            @Override
            protected FilterResults performFiltering(CharSequence constraint) {
                List suggestions = MyApiSuggestionsApi(constraint).get();
                return packageAsFilterResults(suggestions);
            }
        }
    }
    

提交回复
热议问题