@Override protected Event[] doInBackgroundAuto(Void... params) throws JSONResponseException, ClientProtocolException, IOException { Event[] events = null; // Get only those events that the current user administers events = Event.getMine(); return events; }
@Override protected void onPostExecuteAuto(final Event[] events) { ListView listView = (ListView) findViewById(R.id.MyEventsList); // Populate the listView with the user's events. listView.setAdapter(new EventsAdapter(context, events)); // If the user clicks on an event, take them to the Event Admin page for the selected event. listView.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Event event = events[position]; Intent intent = new Intent(context, EventAdminActivity.class) .putExtra("id", event.getId()) .putExtra("eventName", event.getName()); startActivity(intent); } }); // Automatically scroll down to show only those events that are for today and onwards. listView.setSelection(Event.findTodaysPosition(events)); }