• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Fatal Exception: java.lang.IllegalArgumentException width and height must be > 0 on Chromecast imple

Ashish87

Lurker
Nov 6, 2020
1
0
I am trying to implement Chromecast functionality using casty sdk.

Ref: https://github.com/DroidsOnRoids/Casty

But always getting

Fatal Exception: java.lang.IllegalArgumentException width and height must be > 0

android.view.View.draw (View.java:21594)

Below is my code

//Oncreate()
casty = Casty.create(this)
.withMiniController();

casty.setOnConnectChangeListener(new Casty.OnConnectChangeListener() {
@override
public void onConnected() {
Util.showToast(getApplicationContext(), "Connected");
casty.getPlayer().loadMediaAndPlay(createSampleMediaData()...);
}

@override
public void onDisconnected() {
Util.showToast(getApplicationContext(), "Disconnected");
}
});

//Menu
@override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
casty.addMediaRouteMenuItem(menu);
getMenuInflater().inflate(R.menu.browse, menu);
return true;
}

So how can we solve it any idea? Did anyone face it?
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones