ChooseNearLocationActivity

public class ChooseNearLocationActivity extends AppCompatActivity implements SearchView.OnQueryTextListener

This screen let’s the user choose where they live now. This is used by FindNetworkActivity to restrict displayed networks to those with a near that matches where the user lives.

Fields

CHOSEN_PLACE

public static final String CHOSEN_PLACE

Identifier for the Intent whose value is the Location the user chose

RESULT_OK

public static final int RESULT_OK

Result code to signal via the Intent that the user successfully chose a Location

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 list

Parameters:
  • savedInstanceState – Previous state that is passed through to superclass

onQueryTextChange

public boolean onQueryTextChange(String newText)

Whenever the query text changes, do nothing because sending network requests every time is unnecessary.

Parameters:
  • newText – The updated query text
Returns:

Always returns true

onQueryTextSubmit

public boolean onQueryTextSubmit(String query)

When the user submits their query, ChooseNearLocationActivity.search() is run to populated the results with matching Locations

Parameters:
  • query – User’s query. Not used.
Returns:

Always returns true