I am using an ads SDK and creating my container to attach the adview. If the device orientation is portrait I am able to see the view. And if change the orientation to landscape the view isn't visible. It's a blank screen.
This is my container code
private void drawView(AdView.AD_TYPE mAdType){
DisplayMetrics dm = context.getResources().getDisplayMetrics();
pxW = dp2px(mWidth, dm); //Put width of required adView
pxH = dp2px(mHeight, dm); //Put height of required adView
Log.e("Test", "pxW: " + pxW);
Log.e("Test", "pxH: " + pxH);
mAdView.measure(pxW, pxH);
Log.e("Test", "WIDTH : " + mAdView.getMeasuredWidth());
mAdView.layout(0, 0, pxW, pxH);
removeAllViews();
addView(mAdView, new FrameLayout.LayoutParams(pxW, pxH));
pxW = convertDpToPixel(mWidth, dm); //Put width of required adView
pxH = convertDpToPixel(mHeight, dm); //Put height of required adView
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(pxW,pxH);
params.setMargins(40, 0, 40, 0);
mAdView.measure(pxW, pxH);
if (mAdType == AdView.AD_TYPE.CUSTOM_NATIVE) {
mAdView.layout(65, 20, pxW, pxH);
} else {
mAdView.layout(0, 0, pxW, pxH);
}
removeAllViews();
addView(mAdView, params);
}
What is wrong here?