FindNetworkActivity

public class FindNetworkActivity extends DrawerActivity

Fields

REQUEST_NEW_NEAR_LOCATION

public final int REQUEST_NEW_NEAR_LOCATION

near

static Location near

The user’s chosen Location they are near

queue

static RequestQueue queue

Queue to hold asynchronous tasks

Methods

onActivityResult

protected void onActivityResult(int requestCode, int resultCode, Intent data)

When the user has chosen a near location using ChooseNearLocationActivity, this method is called by the Intent that launched the near location chooser with the result of the user’s selection. If they did indeed choose a location, that location is saved and the button text is updated to reflect the location’s name.

Parameters:

onCreate

protected void onCreate(Bundle savedInstanceState)

Setup the activity based on content specified in R.layout.activity_find_network. See code comments for details on implementation.

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

onCreateOptionsMenu

public boolean onCreateOptionsMenu(Menu menu)

Inflate the menu; this adds items to the action bar if it is present.

Parameters:
  • menu – Menu to create
Returns:

Always returns true

onOptionsItemSelected

public boolean onOptionsItemSelected(MenuItem item)

Handles clicks to the action bar.

Parameters:
Returns:

true if the item ID is that of R.id.action_settings. Otherwise, superclass onOptionsItemSelected is called and the resulting value is returned.

onResume

protected void onResume()

{@inheritDoc}

onStop

public void onStop()

This ensures that we are canceling all network requests if the user is leaving this activity. We use a RequestFilter that accepts all requests (meaning it cancels all requests)