I've made this code:
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();
}
}
});
and the problem is that there are 50k stations to download from Parse..my question is: it's possible to start this download after 3 character written? For example after digit "Pin" the query to Parse starts... Thank you