/** * Sets the current server * * <p>When the user touches one of the servers, set that one to be the current_server and send * them to MainActivity */ @Override public void onItemClick(AdapterView<?> l, View v, int position, long id) { JSONObject current_server = null; try { current_server = mServers.getJSONObject(position); } catch (JSONException e) { // We'll just pass null to Preferences, which will wipe current_server // Once they get sent to Home, home will realize there isn't // a current_server and send them back here } Preferences.setCurrentServer(current_server, getActivity()); Intent i = new Intent(getActivity(), MainActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); }