public void findEvents(View view) { EditText usernameField = (EditText) findViewById(R.id.username); String username = usernameField.getText().toString().trim(); currentTaskFind = new FindEventsTask(); if (username.equals("")) { currentTaskFind.execute(); } else { currentTaskFind.execute(username); } }
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putSerializable(EventsKey, new ArrayList<Event>(events)); outState.putSerializable(PreferenceKey, preference); // cancel active tasks if (currentTaskEvents != null) { currentTaskEvents.cancel(false); } if (currentTaskFind != null) { currentTaskFind.cancel(true); } }