List of usage examples for java.lang ClassCastException ClassCastException
public ClassCastException(String s)
ClassCastException
with the specified detail message. From source file:com.deliciousdroid.fragment.MainSearchResultsFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {//from w ww .ja v a 2s . co m searchActionListener = (OnSearchActionListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnSearchActionListener"); } }
From source file:net.sf.nmedit.nomad.core.jpf.JPFServiceInstallerTool.java
@SuppressWarnings("unchecked") private static Class<Service> lookupServiceClass(Map<String, Class<Service>> serviceClassCache, String serviceClassName, ClassLoader loader) throws ClassNotFoundException { Class<Service> serviceClass = serviceClassCache.get(serviceClassName); if (serviceClass != null) return serviceClass; Class<?> _class = Class.forName(serviceClassName); if (!Service.class.isAssignableFrom(_class)) throw new ClassCastException("Service class is not subclass of " + Service.class + ": " + _class); serviceClass = (Class<Service>) _class; serviceClassCache.put(serviceClassName, serviceClass); return serviceClass; }
From source file:com.deliciousdroid.fragment.BrowseBundlesFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {/*from ww w.j ava 2 s .c o m*/ bundleSelectedListener = (OnBundleSelectedListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnBundleSelectedListener"); } }
From source file:com.blogspot.marioboehmer.thingibrowse.fragments.ThingDetailsFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {//from w w w . j a va 2s .c om onNetworkErrorListener = (OnNetworkErrorListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnNetworkErrorListener"); } }
From source file:com.achow101.bitcointalkforum.fragments.TopicFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {// w w w .ja va2s. c om mListener = (OnTopicInteraction) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnTopicInteraction"); } }
From source file:com.deliciousdroid.fragment.BrowseTagsFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {/*from www.ja va 2 s.co m*/ tagSelectedListener = (OnTagSelectedListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnTagSelectedListener"); } }
From source file:com.ntsync.android.sync.activities.LoginProgressDialog.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {//from w w w . j a va 2 s . co m resultListener = (LoginDialogListener) activity; } catch (ClassCastException e) { // The activity doesn't implement the interface, throw exception ClassCastException ex = new ClassCastException( activity.toString() + " must implement LoginDialogListener"); ex.initCause(e); throw ex; } }
From source file:com.cerema.cloud2.ui.fragment.OCFileListFragment.java
/** * {@inheritDoc}/* w ww . ja v a 2 s. c o m*/ */ @Override public void onAttach(Activity activity) { super.onAttach(activity); Log_OC.e(TAG, "onAttach"); try { mContainerActivity = (FileFragment.ContainerActivity) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement " + FileFragment.ContainerActivity.class.getSimpleName()); } try { setOnRefreshListener((OnEnforceableRefreshListener) activity); } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement " + SwipeRefreshLayout.OnRefreshListener.class.getSimpleName()); } }
From source file:com.achow101.bitcointalkforum.fragments.PMReplyFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {//from ww w .j a v a 2 s.co m mListener = (OnPostListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnPostListener"); } }
From source file:mp.paschalis.ChooseLibraryFragment.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 www. j a v a2 s.c o m*/ mCallback = (OnLibrarySelectedListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnLibrarySelectedListener"); } }