Example usage for java.lang ClassCastException getClass

List of usage examples for java.lang ClassCastException getClass

Introduction

In this page you can find the example usage for java.lang ClassCastException getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

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

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

    try {/*from  w ww  . ja v  a 2 s . c  o m*/
        mListener = (UserCropDialogListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement " + e.getClass().toString());
    }
}