Huy Duong Tu
Huy Duong Tu

Reputation: 7928

Integrating Chromecast into application supporting ActionBarSherlock

I'm integrating chromecast into my existing application supporting ActionBarSherlock. I followed this link http://www.droidorbit.com/2013/10/mediarouter-and-actionbarsherlock.html. But I got the error in compile time:

MediaRouterJellybean cannot be resolved to a type.  
MediaRouterJellybeanMr1 cannot be resolved to a type  
MediaRouterJellybeanMr2 cannot be resolved to a type  in SystemMediaRouteProvider.java file.  
R.attr.isLightTheme cannot be resolved or is not a field in MediaRouterThemeHelper.java file.

I currently comments these code for error free, then integrate with the Cast sample project. In the project I display cast icon in the ActionBar with android.support.v7.app.MediaRouteActionProvider instead of using MediaRouteButton. But I got the error in run time in onCreateOptionMenu():

java.lang.ClassCastException: android.support.v7.app.MediaRouteActionProvider cannot be cast to com.actionbarsherlock.view.ActionProvider

I don't know how to fix it. Could anyone help me?
Thanks in advance.
P/S: Could anyone give instructions modifying MediaRouter lib using Eclipse.

Upvotes: 0

Views: 787

Answers (1)

Huy Duong Tu
Huy Duong Tu

Reputation: 7928

I solved it.

Just comment the code in isLightTheme() function and return false.
Copy 3 files MediaRouterJellybean.java, MediaRouterJellybeanMr1.java, MediaRouterJellybeanMr2.java into packet android.support.v7.media.
At that time, you still get the error

MediaRouterJellybeanMr2 cannot be resolved to a type  in SystemMediaRouteProvider.  

In AndroidManifest.xml, set target version = 18, right-click project, select Android Tool -> Clear Lint Marker.
P/S: I'm using Eclipse, not Android studio.

Hope it helps!

Upvotes: 3

Related Questions