Example usage for android.app Activity toString

List of usage examples for android.app Activity toString

Introduction

In this page you can find the example usage for android.app Activity toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:com.mchp.android.PIC32_BTSK.TemperatureFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);

    // This checks that the container activity (BluetoothChat) has implemented
    // the OnSendRequestListener interface. If not, it throws an exception. If it
    // has been implemented, sets mSendRequestCallback to the implementation in the
    // container activity.
    try {/*  w  ww . ja  v a  2  s.c o  m*/
        mSendRequestCallback = (OnSendRequestListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement OnSendRequestListener");
    }

    // This checks that the container activity (BluetoothChat) has implemented
    // the OnTempRequestListener interface. If not, it throws an exception.  If it
    // has been implemented, sets mTempRequestCallback to the implementation in the
    // container activity.
    try {
        mTempRequestCallback = (OnTempRequestListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement OnTempRequestListener");
    }

    return;
}

From source file:com.owncloud.android.ui.preview.PreviewMediaFragment.java

/**
 * {@inheritDoc}//from w  w w.j ava2s  . c  om
 */
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    if (!(activity instanceof FileFragment.ContainerActivity))
        throw new ClassCastException(activity.toString() + " must implement "
                + FileFragment.ContainerActivity.class.getSimpleName());
}

From source file:com.achow101.bitcointalkforum.fragments.TopicFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {/* w ww . ja v a 2s .  c  o m*/
        mListener = (OnTopicInteraction) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement OnTopicInteraction");
    }
}

From source file:org.bombusim.lime.fragments.ChatFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);

    if (!(activity instanceof ChatFragmentListener))
        throw new ClassCastException(activity.toString() + " must implement ChatFragmentListener");

    serviceBinding = new XmppServiceBinding(activity);
}

From source file:com.andrada.sitracker.ui.fragment.DirectoryChooserFragment.java

@Override
public void onAttach(@NotNull Activity activity) {
    super.onAttach(activity);
    try {/*ww  w.  java2 s.  co m*/
        mListener = (OnFragmentInteractionListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement OnFragmentInteractionListener");
    }
}

From source file:net.globide.coloring_book.MainPanelFragment.java

/**
 * Implements onAttach()./*from w  w w .  j av a  2 s.  co m*/
 */
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {
        // When the fragment is added to the display screen, have this
        // class's mListener property reference the host activity's
        // OnMainPanelTouchListener implementation. This allows this
        // fragment to both fire events to the host activity AND forces
        // activities using this fragment to implement
        // OnMainPanelTouchListener.
        mListener = (OnMainPanelTouchListener) activity;
    } catch (ClassCastException e) {
        // If the class using this fragment is NOT implementing
        // OnBrowseTouchListener, throw an exception.
        throw new ClassCastException(activity.toString() + " must implement OnBrowseListTouchListener");
    }
}

From source file:com.pdftron.pdf.controls.AnnotationDialogFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {/*from ww w  . j  a  va2  s .co m*/
        mListener = (AnnotationDialogFragmentListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement AnnotationDialogFragmentListener");
    }
}

From source file:jayen.library.rbgcolorpicker.ColorPickerSupportDialogFrag.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    // Verify that the host activity/fragment implements the callback interface
    try {/*w w  w . j  a v a 2  s  .  c o  m*/
        // Instantiate the ColorPickerDialogListener so we can send events to the host
        // If there is a target fragment then use that as the listener.
        mListener = (ColorPickerDialogListener) this.getTargetFragment();
        if (mListener == null) {
            //no target fragment so use activity
            mListener = (ColorPickerDialogListener) activity;
        }
    } catch (ClassCastException e) {
        // The activity doesn't implement the interface, throw exception
        throw new ClassCastException(activity.toString() + " must implement ColorPickerDialogListener");
    }
}

From source file:net.alexjf.tmm.fragments.ImmedTransactionEditorFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {/*from w w w .j  a v  a  2s.c om*/
        listener = (OnImmediateTransactionEditListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(
                activity.toString() + " must implement OnImmediateTransactionEditListener");
    }
}

From source file:com.xamoom.android.xamoomcontentblocks.XamoomContentFragment.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);

    Activity activity;
    if (context instanceof Activity) {
        activity = (Activity) context;//w  w w  .  jav a  2 s .  co m

        try {
            OnXamoomContentFragmentInteractionListener listener = (OnXamoomContentFragmentInteractionListener) activity;
            mContentBlockAdapter.setOnXamoomContentFragmentInteractionListener(listener);
        } catch (ClassCastException e) {
            throw new ClassCastException(
                    activity.toString() + " must implement OnXamoomContentFragmentInteractionListener");
        }
    }
}