This topic is a following of my last one: How to mirror a fragment to a presentation in Android?
I managed to duplicate my fragment on the external display by using the library "Presentation" from CommonsWare Android Components (CWAC).
However, it resizes the initial fragment to optimize the user experience of the presentation (it is better displayed on the external screen than the device) but in my case, I would like the opposite.
Therefor, I searched in the library where it resizes the original fragment, and it appears it's in the class AspectLockedFrameLayout.java
and more precisely, in the method void onMeasure(int widthSpec, int heightSpec)
.
I tried to not modify lockedWidth
and lockedHeight
(by putting them in commentary) and it seems to work: the initial fragment is not resized and the displaying suits me.
However, the app crashes when I connect the external display before having launched the app and it's a bit annoying.
After a lot of tests, I found that in the class MirroringFrameLayout.java
and in the method public void draw(Canvas canvas)
, the variable bmp is null and then, crash.
Do you know where is the problem and how to solve it?
Thanks a lot,
Best regards.