如何使用AutoCompleteTextView在后台进行此查询?

时间:2016-05-25 07:31:29

标签: android parse-platform

我已经制作了这段代码:

 public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
    View view = inflater.inflate(R.layout.fragment_search, container, false);
    Button search = (Button)view.findViewById(R.id.cerca);
    andata = (AutoCompleteTextView)view.findViewById(R.id.andata);
    ritorno = (AutoCompleteTextView)view.findViewById(R.id.ritorno);
    //set adapters

    ParseQuery<ParseObject>query = ParseQuery.getQuery("Stations");

    query.findInBackground(new FindCallback<ParseObject>()
    {
        @Override
        public void done(List<ParseObject> list, ParseException e)
        {
            if(e == null)
            {
                for(int i = 0; i<list.size();i++)
                {
                    String name = list.get(i).getString("code");
                    StationNames.add(name);

                }

                String [] strAdapter = new String[StationNames.size()];
                strAdapter=StationNames.toArray(strAdapter);
                ArrayAdapter<String>adapter = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,strAdapter);
                andata.setAdapter(adapter);
                ritorno.setAdapter(adapter);

            }
            else
            {
              e.printStackTrace();
            }

        }
    });

问题是从Parse有50k站点下载。我的问题是:在写完3个字符后可以开始下载吗?例如,在数字“Pin”之后,对Parse的查询开始... 谢谢

0 个答案:

没有答案