List of usage examples for java.lang ClassCastException ClassCastException
public ClassCastException(String s)
ClassCastException
with the specified detail message. From source file:com.csusm.twinder.Fragment.QRScanFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); if (activity instanceof OnScanCompleteListener) { mCallback = (OnScanCompleteListener) activity; } else {//from w w w . j a v a 2s . c o m throw new ClassCastException( "Activity hosting the QRScanFragment must implement the OnScanCompleteListener interface"); } }
From source file:com.ericbarnhill.arrayMath.MathArrayDouble1D.java
protected MathArrayDouble1D add(Complex g) { throw new ClassCastException("Cannot add Complex number to double array"); }
From source file:net.eledge.android.europeana.gui.dialog.NameInputDialog.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {//ww w .j a v a 2 s . c o m mListener = (NameInputDialogListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement NameInputDialogListener"); } }
From source file:com.ericbarnhill.arrayMath.MathArrayDouble2D.java
protected MathArrayDouble2D add(Complex g) { throw new ClassCastException("Cannot add Complex number to double array"); }
From source file:com.ericbarnhill.arrayMath.MathArrayDouble3D.java
protected MathArrayDouble3D add(Complex g) { throw new ClassCastException("Cannot add Complex number to double array"); }
From source file:com.brookmanholmes.bma.wizard.ui.BaseChoiceFragment.java
@Override public void onAttach(Context context) { super.onAttach(context); if (getParentFragment() instanceof PageFragmentCallbacks) { callbacks = (PageFragmentCallbacks) getParentFragment(); } else if (getActivity() instanceof PageFragmentCallbacks) { callbacks = (PageFragmentCallbacks) getActivity(); } else {//from w w w . j ava 2 s . c o m throw new ClassCastException("Activity/ParentFragment must implement PageFragmentCallbacks"); } }
From source file:com.davidmascharka.lips.SelectPartitionDialogFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); // Verify the host activity implements the callback interface try {/* www. j a va 2 s. co m*/ // Instantiate the listener so we can send events to the host listener = (SelectPartitionDialogListener) activity; } catch (ClassCastException e) { // The activity doesn't implement the interface throw new ClassCastException(activity.toString() + " must implement SelectPartitionDialogListener"); } }
From source file:at.wada811.imageslider.DebugFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); if (activity instanceof DebugFragmentCallbackProvider == false) { throw new ClassCastException(activity.getLocalClassName() + " must implements " + DebugFragmentCallbackProvider.class.getSimpleName()); }// w w w .j ava 2 s . c o m DebugFragmentCallbackProvider provider = (DebugFragmentCallbackProvider) activity; mCallback = provider.getDebugCallback(); }
From source file:com.dazone.crewchat.libGallery.fragment.ImageFragment.java
@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 {//from ww w.j a v a 2s. c o m mCallback = (OnImageSelectedListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnImageSelectedListener"); } }
From source file:answer.example.answer.view.FileListFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {/*w w w . j av a2s . c o m*/ mListener = (Callbacks) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement FileListFragment.Callbacks"); } }