I have the following problem: I have an image that I want to disappear when I change my phone from portrait to landscape. It works perfectly fine when I am on the current activity and I move orientations. It also works completely fine if I go to another activity and come back. But the problem is that after I return to my main page, onConfigurationChanged() will not be called the first time I change orientation. The image will show/not show correctly when I return, but when I first change the orientation after returning onConfigurationChanged() will not be called and the image will either stay/not stay until the second time I change the orientation. Any help you guys have would be extremely appreciated! Here's a couple parts of my code. Ive put the configChange- orientation permission in the manifest already so thats not a problem.
@Override
public void onConfigurationChanged(Configuration newConfig) {L.p("configList",5200184);
super.onConfigurationChanged(newConfig);
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE&&isVertical==true) {
Logo.setVisibility(ImageView.GONE);
mainLogo.setVisibility(ImageView.GONE);
isHorizontal=true;
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT&&isHorizontal==true){
Logo.setVisibility(ImageView.VISIBLE);
mainLogo.setVisibility(ImageView.VISIBLE);
isVertical=true;
}
}
@Override
protected void onResume() {L.p("onResumeList", 5200113);
super.onResume();
Context ctx = getApplicationContext();
WindowManager wm = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
if((display.getOrientation() == Surface.ROTATION_90) || (display.getOrientation() == Surface.ROTATION_270))
{//Horizontal
L.p("you are resuming horizontal",5200124);
Logo.setVisibility(ImageView.INVISIBLE);
mainLogo.setVisibility(ImageView.INVISIBLE);
isHorizontal=true;
//isVertical=false;
}
else {//Vertical
L.p("you are resuming vertical",5200131);
Logo.setVisibility(ImageView.VISIBLE);
mainLogo.setVisibility(ImageView.VISIBLE);
isVertical=true;
// isHorizontal=false;
}
tracker.trackPageView("/deviceList");
}
Thanks!