Java Code Examples for android.app.Activity#toString()

The following examples show how to use android.app.Activity#toString() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: android_coursera_1   File: FriendsFragment.java    License: MIT License 6 votes vote down vote up
@Override
public void onAttach(Activity activity) {
	super.onAttach(activity);

	// Make sure that the hosting Activity has implemented
	// the SelectionListener callback interface. We need this
	// because when an item in this ListFragment is selected, 
	// the hosting Activity's onItemSelected() method will be called.
	
	try {

		mCallback = (SelectionListener) activity;

	} catch (ClassCastException e) {
		throw new ClassCastException(activity.toString()
				+ " must implement SelectionListener");
	}
}
 
Example 2
@Override
public void onAttach(Activity activity)
{
	super.onAttach(activity);
	
	// This makes sure that the container activity has implemented
	// the callback interface. If not, it throws an exception
	try
	{
		waypointActionsCallback = (OnWaypointActionListener) activity;
	}
	catch (ClassCastException e)
	{
		throw new ClassCastException(activity.toString() + " must implement OnWaypointActionListener");
	}
}
 
Example 3
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {
        activityCallback = (NewContentCallback) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement NewContentCallback");
    }
}
 
Example 4
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {
        mListener = (OnVideoURISelectedListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString()
                + " must implement OnVideoURISelectedListener");
    }
}
 
Example 5
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {
        mListener = (OnFragmentInteractionListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString()
                + " must implement OnFragmentInteractionListener");
    }
    Log.d(VideoItemFragment.class.getName(), "onAttach Called");
}
 
Example 6
@SuppressWarnings("deprecation")
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    // Verify that the host activity implements the callback interface
    try {
        // Instantiate the Listener so we can send events to the host
        listener = (Listener) activity;
    } catch (ClassCastException e) {
        // The activity doesn't implement the interface, throw exception
        throw new ClassCastException(activity.toString()
                                     + " must implement Listener");
    }
}
 
Example 7
Source Project: Smartlab   File: BookDetailsFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onAttach(Activity activity) {
	super.onAttach(activity);
	try {
		mListener = (OnBookDetailsFragmentListener) activity;
	} catch (ClassCastException e) {
		throw new ClassCastException(activity.toString()
				+ " must implement OnFragmentInteractionListener");
	}
}
 
Example 8
Source Project: MediaChooser   File: ImageFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);

    // This makes sure that the container activity has implemented
    // the callback interface. If not, it throws an exception
    try {
        mCallback = (OnImageSelectedListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement OnImageSelectedListener");
    }
}
 
Example 9
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {
        mListener = (Listener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString()
                + " must implement Listener");
    }
}
 
Example 10
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {
        mListener = (OnFragmentInteractionListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString()
                + " must implement OnFragmentInteractionListener");
    }
}
 
Example 11
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {
        mListener = (ShareFragmentListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString()
                + " must implement OnFragmentInteractionListener");
    }
}
 
Example 12
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {
        mListener = (OnCurrentFragmentInteractionListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString()
                + " must implement OnFragmentInteractionListener");
    }
}
 
Example 13
Source Project: android-storage   File: RenameDialog.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {
        mListener = (DialogListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString()
                + " must implement DialogListener");
    }
}
 
Example 14
@SuppressWarnings("deprecation")
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    // Verify that the host activity implements the callback interface
    try {
        // Instantiate the Listener so we can send events to the host
        listener = (Listener) activity;
    } catch (ClassCastException e) {
        // The activity doesn't implement the interface, throw exception
        throw new ClassCastException(activity.toString()
                + " must implement Listener");
    }
}
 
Example 15
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {
        mListener = (OnFragmentInteractionListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString()
                + " must implement OnFragmentInteractionListener");
    }
}
 
Example 16
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    Fragment f = getParentFragment();
    if (activity instanceof ConfirmListener) {
        mListener = (ConfirmListener) activity;
    } else if (f instanceof ConfirmListener) {
        mListener = (ConfirmListener) f;
    } else {
        throw new ClassCastException(activity.toString() + " must implement ConfirmListener");
    }
}
 
Example 17
@Override
public void onAttach(Activity activity) {
  super.onAttach(activity);
  try {
    caller = (ChooseAccountCaller) activity;
  } catch (ClassCastException e) {
    throw new ClassCastException(
        activity.toString() + " must implement " + ChooseAccountCaller.class.getSimpleName());
  }
}
 
Example 18
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {
        mListener = (OnFragmentInteractionListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString()
                + " must implement OnFragmentInteractionListener");
    }
}
 
Example 19
Source Project: MediaChooser   File: VideoFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);

    // This makes sure that the container activity has implemented
    // the callback interface. If not, it throws an exception
    try {
        mCallback = (OnVideoSelectedListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement OnVideoSelectedListener");
    }
}
 
Example 20
Source Project: open_flood   File: SeedDialogFragment.java    License: MIT License 5 votes vote down vote up
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {
        listener = (SeedDialogFragment.SeedDialogFragmentListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString()
                + " must implement SeedDialogFragmentListener");
    }
}