Example usage for android.content Context toString

List of usage examples for android.content Context toString

Introduction

In this page you can find the example usage for android.content Context toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.java_lang_programming.android_recycleview_demo.ui.AutoScrollRecyclerViewFragment.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof OnFragmentInteractionListener) {
        listener = (OnFragmentInteractionListener) context;
    } else {//from   w  w w.j a  va 2  s  .  c o  m
        throw new RuntimeException(context.toString() + " must implement OnFragmentInteractionListener");
    }
}

From source file:org.gateshipone.odyssey.fragments.AlbumsFragment.java

/**
 * Called when the fragment is first attached to its context.
 *///from  www . j a  v  a  2 s.  com
@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");
    }
}

From source file:com.heske.alexandria.activities.ListOfBooksFragment.java

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

    // The hosting Activity must implement
    // Callback interface.
    try {//from w ww.  jav  a  2s. c o m
        mCallback = (BookListCallback) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(
                context.toString() + getResources().getString(R.string.errorMissingCallbackMethod)
                        + mCallback.getClass().getSimpleName());
    }
}

From source file:cl.smartcities.isci.transportinspector.fragments.ReportMapFragment.java

@Override
public void onAttach(Context activity) {
    super.onAttach(activity);
    try {// ww w  .jav a  2 s .  c o  m
        focusListener = (InterfaceFocusListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement InterfaceFocusListener");
    }
}

From source file:com.microsoft.identity.client.sample.SigninFragment.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof OnFragmentInteractionListener) {
        // Main Activity implemented the SigninFragment.OnFragmentInteractionListener, SigninFragment here gets a
        // reference to MainActivity to call the onSigninClicked
        mListener = (OnFragmentInteractionListener) context;
    } else {/*  ww w .ja  va2 s.com*/
        throw new IllegalStateException(context.toString() + " must implement OnFragmentInteractionListener");
    }
}

From source file:com.rascarlo.aurdroid.ui.SearchResultFragment.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof SearchResultFragmentCallback) {
        searchResultFragmentCallback = (SearchResultFragmentCallback) context;
    } else {//ww w. j a  v a 2 s.c o m
        throw new RuntimeException(context.toString() + " must implement SearchResultFragmentCallback");
    }
}

From source file:net.ec_cube.eccube_Android.PushRegistrationFragment.java

/**
 * {@inheritDoc}//  w w  w.j  a va 2s .  c  o m
 */
@Override
public void onAttach(Context context) {
    super.onAttach(context);
    try {
        mListener = (PushRegistrationListener) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(
                context.toString() + " must implemens " + PushRegistrationListener.class.getName());
    }
}

From source file:com.akalizakeza.apps.ishusho.activity.NewPostUploadTaskFragment.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof TaskCallbacks) {
        mCallbacks = (TaskCallbacks) context;
    } else {/*from ww w.  ja  v a2  s  .  co m*/
        throw new RuntimeException(context.toString() + " must implement TaskCallbacks");
    }
    mApplicationContext = context.getApplicationContext();
}

From source file:org.asteroidos.sync.fragments.DeviceDetailFragment.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    if (context instanceof DeviceDetailFragment.OnDefaultDeviceUnselectedListener)
        mDeviceListener = (DeviceDetailFragment.OnDefaultDeviceUnselectedListener) context;
    else/* ww w .  jav a  2  s  . c  om*/
        throw new ClassCastException(context.toString()
                + " does not implement DeviceDetailFragment.OnDefaultDeviceUnselectedListener");

    if (context instanceof DeviceDetailFragment.OnConnectRequestedListener)
        mConnectListener = (DeviceDetailFragment.OnConnectRequestedListener) context;
    else
        throw new ClassCastException(
                context.toString() + " does not implement DeviceDetailFragment.OnConnectRequestedListener");
}

From source file:com.heske.alexandria.activities.BookDetailFragment.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);
    mActivity = context;//from   w ww.  j  a  v  a 2 s . co m

    // The hosting Activity must implement
    // Callback interface.
    try {
        mCallback = (BookDetailCallback) context;
    } catch (ClassCastException e) {
        throw new ClassCastException(
                context.toString() + getResources().getString(R.string.errorMissingCallbackMethod)
                        + mCallback.getClass().getSimpleName());
    }
}