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

The following examples show how to use android.app.Activity#toString() . 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 File: WaypointList.java    From Androzic with GNU General Public License v3.0 6 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
	{
		waypointActionsCallback = (OnWaypointActionListener) activity;
	}
	catch (ClassCastException e)
	{
		throw new ClassCastException(activity.toString() + " must implement OnWaypointActionListener");
	}
}
 
Example 2
Source File: FriendsFragment.java    From android_coursera_1 with 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 3
Source File: CurrentFragment.java    From openvidonn with GNU General Public License v3.0 5 votes vote down vote up
@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 4
Source File: SeedDialogFragment.java    From open_flood with 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");
    }
}
 
Example 5
Source File: VideoFragment.java    From MediaChooser with 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 6
Source File: AlarmsFragment.java    From openvidonn with GNU General Public License v3.0 5 votes vote down vote up
@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 7
Source File: ChooseAccountDialogFragment.java    From mytracks with Apache License 2.0 5 votes vote down vote up
@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 8
Source File: ConfirmDialogFragment.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
@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 9
Source File: MyTickets.java    From faveo-helpdesk-android-app with Open Software License 3.0 5 votes vote down vote up
@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 10
Source File: ProfileEditFragment.java    From SecondScreen with Apache License 2.0 5 votes vote down vote up
@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 11
Source File: RenameDialog.java    From android-storage with 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 12
Source File: SearchShareesFragment.java    From Cirrus_depricated with GNU General Public License v2.0 5 votes vote down vote up
@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 13
Source File: ContactsFragment.java    From AndroidGradientUI with Apache License 2.0 5 votes vote down vote up
@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 14
Source File: MessageListFragment.java    From zulip-android with Apache License 2.0 5 votes vote down vote up
@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 15
Source File: ImageFragment.java    From MediaChooser with 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 16
Source File: BookDetailsFragment.java    From Smartlab with 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 17
Source File: MultipleVersionsDialogFragment.java    From SecondScreen with Apache License 2.0 5 votes vote down vote up
@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 18
Source File: VideoItemFragment.java    From android-tv-leanback with Apache License 2.0 5 votes vote down vote up
@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 19
Source File: VideoURIInputDialogFragment.java    From MediaPlayer-Extended with Apache License 2.0 5 votes vote down vote up
@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 20
Source File: DialogNewContent.java    From Gazetti_Newspaper_Reader with MIT License 5 votes vote down vote up
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {
        activityCallback = (NewContentCallback) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement NewContentCallback");
    }
}