// onAttach(Activity activity) is called by the onAttach(Context context) if there is a host
 // activity. Calling onAttach(Activity activity) directly is deprecated.
 public void onAttach(Context context) {
   super.onAttach(context);
   try {
     Activity activity = (Activity) context;
     mListener = (FourthFragmentListener) activity;
   } catch (ClassCastException e) {
     throw new ClassCastException(context.toString() + " must implement FourthFragmentListener");
   }
 }
 @Override
 public void onAttach(Context context) {
   super.onAttach(context);
   if (context instanceof OnFilmSelectedListener) {
     listener = (OnFilmSelectedListener) context;
   } else {
     throw new RuntimeException(context.toString() + " must implement OnFilmSelectedListener");
   }
 }
 @Override
 public void onAttach(Context context) {
   super.onAttach(context);
   if (context instanceof ClosetCallback) {
     mCallback = (ClosetCallback) context;
   } else {
     throw new RuntimeException(context.toString() + " must implement Callback");
   }
 }
 @Override
 public void onAttach(Context context) {
   super.onAttach(context);
   if (context instanceof OnMovieSelectedListener) {
     movieSelectedListener = (OnMovieSelectedListener) context;
   } else {
     throw new ClassCastException(context.toString() + " must implement OnMovieSelectedListener");
   }
 }
 @Override
 public void onAttach(Context context) {
   super.onAttach(context);
   try {
     activityCommander = (TopSectionListener) context;
   } catch (ClassCastException e) {
     throw new ClassCastException(context.toString());
   }
 }
 @Override
 // called as soon as a fragment is attached to an activity
 public void onAttach(Context context) {
   super.onAttach(context);
   try {
     mOnCardAddedListener = (OnCardAddedListener) context;
   } catch (ClassCastException e) {
     throw new ClassCastException(context.toString() + e.getMessage());
   }
 }
 @Override
 public void onAttach(Context context) {
   super.onAttach(context);
   try {
     mPermissionModifiedListener = (OnPermissionModifiedListener) context;
   } catch (ClassCastException e) {
     throw new ClassCastException(
         context.toString() + " must implement OnPermissionModifiedListener");
   }
 }
 @Override
 public void onAttach(Context context) {
   super.onAttach(context);
   try {
     callback = (ICallback) context;
   } catch (ClassCastException e) {
     throw new ClassCastException(
         context.toString() + " must implement OnHeadlineSelectedListener");
   }
 }
Exemple #9
0
 @Override
 public void onAttach(Context context) {
   super.onAttach(context);
   if (context instanceof OnProfileInteractionListener) {
     mListener = (OnProfileInteractionListener) context;
   } else {
     throw new RuntimeException(
         context.toString() + " must implement OnProfileInteractionListener");
   }
 }
 @Override
 public void onAttach(Context context) {
   super.onAttach(context);
   try {
     mClassProgressionHelper = (ClassProgressionHelper) context;
     mClassProgressionHelper.getClassProgression().registerListener(this);
   } catch (ClassCastException e) {
     throw new ClassCastException(context.toString() + " must implement ClassProgressionHelper");
   }
 }
 public TouchableWrapper(Context context) {
   super(context);
   // Force the host activity to implement the UpdateMapAfterUserInterection Interface
   try {
     updateMapAfterUserInterection = (UpdateMapAfterUserInterection) context;
   } catch (ClassCastException e) {
     throw new ClassCastException(
         context.toString() + " must implement UpdateMapAfterUserInterection");
   }
 }
Exemple #12
0
  @Override
  public void onAttach(Context context) {
    super.onAttach(context);

    try {
      listener = (NavDrawerInterface) context;
    } catch (ClassCastException e) {
      throw new ClassCastException(context.toString() + " must implement NavDrawer");
    }
  }
 public void onAttach(Context a) {
   super.onAttach(a);
   try {
     // Instantiate the NoticeDialogListener so we can send events to the host
     mListener = (AddPhoneListener) a;
   } catch (ClassCastException e) {
     // The activity doesn't implement the interface, throw exception
     throw new ClassCastException(a.toString() + " must implement PhoneBookListener");
   }
 }
Exemple #14
0
 @Override
 public void onAttach(Context context) {
   super.onAttach(context);
   try {
     mListener = (OnFragmentInteractionListener) context;
   } catch (ClassCastException e) {
     throw new ClassCastException(
         context.toString() + " must implement OnFragmentInteractionListener");
   }
 }
 @Override
 public void onAttach(Context context) {
   super.onAttach(context);
   // context -> activity
   try {
     mListener = (RegisterListener) context;
   } catch (ClassCastException exception) {
     throw new ClassCastException(
         context.toString() + "must implement LoginFragment.LoginListener");
   }
 }
 @Override
 public void onAttach(Context context) {
   super.onAttach(context);
   try {
     mListener = (SectionInteractionListener) context;
   } catch (ClassCastException e) {
     throw new ClassCastException(
         context.toString() + " must implement SectionInteractionListener");
   }
   mListener.onSectionAttached(getArguments().getInt(ARG_SECTION_NUMBER));
 }
 @Override
 public void onAttach(Context context) {
   super.onAttach(context);
   mContext = context;
   if (context instanceof OnReportIncidentClickedListener) {
     mListener = (OnReportIncidentClickedListener) context;
   } else {
     throw new RuntimeException(
         context.toString() + " must implement OnReportIncidentClickedListener");
   }
 }
  @Override
  public void onAttach(Context context) {
    super.onAttach(context);

    if (context instanceof ChooseLetterListener) {
      mListener = (ChooseLetterListener) context;
    } else {
      throw new ClassCastException(
          context.toString() + " must implement " + TAG + ".SwapTilesListener");
    }
  }
  @Override
  public void onAttach(Context context) {
    super.onAttach(context);

    try {
      timeTableDataContext = (IGetTimeTableData) context;
    } catch (ClassCastException e) {
      throw new ClassCastException(context.toString() + " must implement IGetCourseData");
    }

    mSectionsPagerAdapter = new SectionsPagerAdapter();
  }
 @Override
 public void onAttach(Context context) {
   super.onAttach(context);
   try {
     // gracias al metodo on Attach damos valor al clickCallBack evitamos Null value
     clickCallBack = (ClickCallBack) context;
     //  mListener = (OnFragmentInteractionListener) context;
   } catch (ClassCastException e) {
     throw new ClassCastException(
         context.toString() + " must implement OnFragmentInteractionListener");
   }
 }
  @Override
  public void onAttach(Context context) {
    super.onAttach(context);

    try {
      if (context instanceof Activity) {
        callback = (OnNoteStateChangeListener) context;
      }
    } catch (ClassCastException e) {
      throw new ClassCastException(context.toString() + " implement interfaces!");
    }
  }
  /** Called when the fragment is first attached to its context. */
  @Override
  public void onAttach(Context context) {
    super.onAttach(context);

    // This makes sure that the container activity has implemented
    // the callback interface. If not, it throws an exception
    try {
      mArtistSelectedCallback = (OnArtistSelectedListener) context;
    } catch (ClassCastException e) {
      throw new ClassCastException(context.toString() + " must implement OnArtistSelectedListener");
    }
  }
 @Override
 public void onAttach(Context context) {
   super.onAttach(context);
   // Verify that the host activity implements the callback interface
   try {
     // Instantiate the TastePickedListener so we can send events to the host
     mTmpTastePickedListener = (OnTmpTastePickedListener) context;
   } catch (ClassCastException e) {
     // The activity doesn't implement the interface, throw exception
     throw new ClassCastException(context.toString() + " must implement TmpTastePickedListener");
   }
 }
  @Override
  public void onAttach(Context context) {
    super.onAttach(context);

    if (context instanceof Activity) {
      try {
        mListener = (MyStatFragmentListener) context;
      } catch (ClassCastException e) {
        throw new ClassCastException(context.toString() + " must implement MyFoodFragmentListener");
      }
    }
  }
 @Override
 public void onAttach(Context context) {
   super.onAttach(context);
   try {
     mListener = (OnFragmentInteractionListener) context;
   } catch (ClassCastException e) {
     throw new ClassCastException(
         context.toString() + " must implement OnFragmentInteractionListener");
   }
   if (context instanceof MainActivity) {
     ((MainActivity) context).onSectionAttached(getArguments().getInt(ARG_SECTION_NUMBER));
   }
 }
 @Override
 public void onAttach(Context context) {
   // INICIAMOS el Comunicador y le asignamos el contexto
   comunicador = (Comunicador) context;
   // Nos aseguramos de que la actividad contenedora haya implementado la
   // interfaz de retrollamada. Si no, lanzamos una excepción
   super.onAttach(context);
   if (context instanceof OnFragmentInteractionListener) {
     mListener = (OnFragmentInteractionListener) context;
   } else {
     throw new RuntimeException(
         context.toString() + " must implement OnFragmentInteractionListener");
   }
 }
Exemple #27
0
  public static void printException(Context ctx, String msg, Exception ex) {
    try {
      if (LibConf.ISRELEASE) return;

      Log.d(LibConf.LOGTAG, ComUtil.conStr("[ & ]", ex.getClass().toString()));
      Log.d(LibConf.LOGTAG, ComUtil.conStr("    CONTEXT=[&]", ctx.toString()));
      Log.d(LibConf.LOGTAG, ComUtil.conStr("    MESSAGE=[&]", msg));
      Log.d(LibConf.LOGTAG, ComUtil.conStr("    &", ex.getMessage()));
      for (int i = 0; i < ex.getStackTrace().length; i++) {
        Log.d(LibConf.LOGTAG, ex.getStackTrace()[i].toString());
      }
    } catch (Exception e) {
      Log.d(LibConf.LOGTAG, "[ printException error ]");
      e.printStackTrace();
    }
  }
  public MetadataRetrieverTask(Context context, long[] list) {
    mIsCancelled = false;
    mStatus = AsyncTask.Status.PENDING;

    mContext = context;
    mList = list;

    // Verify that the host activity implements the callback interface
    try {
      // Instantiate the MetadataRetrieverListener so we can send events to the host
      mListener = (MetadataRetrieverListener) context;
    } catch (ClassCastException e) {
      // The activity doesn't implement the interface, throw exception
      throw new ClassCastException(
          context.toString() + " must implement MetadataRetrieverListener");
    }
  }
  @Override
  public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof OnListFragmentInteractionListener) {
      mListener = (OnListFragmentInteractionListener) context;
      mListener.onTitleChaged(getString(R.string.fragment_title_weatherlistfragment));
    } else {
      throw new RuntimeException(
          context.toString() + " must implement OnListFragmentInteractionListener");
    }

    // Register to receive messages.
    // We are registering an observer (mMessageReceiver) to receive Intents
    // with actions named {@link Config.EVENT_TABLE_CITY_WEATHER_CHANGED}.
    getActivity()
        .registerReceiver(
            contentChangeReceiver, new IntentFilter(Config.EVENT_TABLE_CITY_WEATHER_CHANGED));
  }
  @Override
  public void onAttach(Context context) {
    super.onAttach(context);

    if (context instanceof OnRageComicSelected) {
      mListener = (OnRageComicSelected) context;
    } else {
      throw new ClassCastException(context.toString() + " must implement OnRageComicSelected");
    }
    // Get rage faces names and descriptions.
    final Resources resources = context.getResources();
    mNames = resources.getStringArray(R.array.names);
    mDescriptions = resources.getStringArray(R.array.descriptions);
    mUrls = resources.getStringArray(R.array.urls);

    // Get rage face images
    final TypedArray typedArray = resources.obtainTypedArray(R.array.images);
    final int imageCount = mNames.length;
    mImageResIds = new int[imageCount];
    for (int i = 0; i < imageCount; i++) {
      mImageResIds[i] = typedArray.getResourceId(i, 0);
    }
    typedArray.recycle();
  }