ChooseNearLocationActivity¶
-
public class
ChooseNearLocationActivityextends AppCompatActivity implements SearchView.OnQueryTextListener¶ This screen let’s the user choose where they live now. This is used by
FindNetworkActivityto restrict displayed networks to those with anearthat matches where the user lives.
Methods¶
onCreate¶
-
protected void
onCreate(Bundle savedInstanceState)¶ Setup the activity. Also initializes the
com.android.volley.RequestQueue, the adapter that populates the list of results, and the listener that handles clicks on items in the results listParameters: - savedInstanceState – Previous state that is passed through to superclass
onQueryTextChange¶
onQueryTextSubmit¶
-
public boolean
onQueryTextSubmit(String query)¶ When the user submits their query,
ChooseNearLocationActivity.search()is run to populated the results with matchingLocationsParameters: - query – User’s query. Not used.
Returns: Always returns
true
search¶
-
public void
search()¶ Get the query present in the
ChooseNearLocationActivity.searchViewand pass it to the server viaAPI.Get.autocompletePlace(RequestQueue,String,Response.Listener)to get a list of matchingLocations. These are used to populate theChooseNearLocationActivity.adapter.