Android Open Source - iEtueri Today Fragment

From Project

Back to project page iEtueri.


The source code is released under:

GNU General Public License

If you think the Android project iEtueri listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package today;
/*from w w  w. ja  va 2  s  .co  m*/
import java.util.ArrayList;
import java.util.Calendar;

import navigationdrawer.MainActivity;
import navigationdrawer.NavigationDrawerController;
import schedule.Event;
import schedule.EventsManager;
import schedule.FindEvents;
import schedule.RefreshScheduleEventsData;
import schedule.ScheduleTodayAdapter;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.Toast;

import com.javils.ietueri.R;

/** This class is for Today View */
public class TodayFragment extends Fragment {

  /** Views */
  private static ListView listEvents;

  private static boolean iAmActive = false;

  public static Handler updaterHandler = new Handler() {
    public void handleMessage(Message msg) {
      switch (msg.what) {
      case RefreshScheduleEventsData.CALENDAR_DATA_CHANGE:
        // Update adapter of the ListView
        ((ScheduleTodayAdapter) listEvents.getAdapter()).notifyDataSetChanged();

  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_today, container, false);

    listEvents = (ListView) view.findViewById(;

    Toast.makeText(getActivity(), "Cargando Eventos...", Toast.LENGTH_LONG).show();

    Calendar now = Calendar.getInstance();
    int year = now.get(Calendar.YEAR);
    int month = now.get(Calendar.MONTH);
    int day = now.get(Calendar.DAY_OF_MONTH);

    ScheduleTodayAdapter adapter = new ScheduleTodayAdapter(view.getContext(), R.layout.schedule_list_item,
        new ArrayList<Event>());


    ArrayList<Event> events = new ArrayList<Event>();


    new Thread(new FindEvents(getActivity(), adapter, events, year, month, day, true)).start();

    return view;

  public void onDestroyView() {

  public void onAttach(Activity activity) {
    ((MainActivity) activity).onSectionAttached(getArguments()

  public static boolean isiAmActive() {
    return iAmActive;

  public static void setiAmActive(boolean iAmActive) {
    TodayFragment.iAmActive = iAmActive;

Java Source Code List