<script>
document.addEventListener("orientationChanged", updateOrientation);
function updateOrientation(e) {
switch (e.orientation)
{
case 0:
// Do your thing
break;
case -90:
var ele=document.getElementById("photoBox")
ele.width='200px';
ele.height='200px';
ele.style.float='center';
break;
case 90:
var ele=document.getElementById("photoBox")
ele.width='200px';
ele.height='200px';
ele.style.float='center';
break;
default:
break;
}
}
</script>
I have used this is code for the Gallery in my application. The problem that i am facing is, whenever I change the orientation of the device, the images disappear. I do not get any error message in the logcat.
I am very specific about the code being in javascript. Inspite of me using it for android, i cant make any changes on the native side.
Any help is appreciated.
Thanks.
you can do this by adding “configChanges” attribute in your activity in AndroidManifest.xml as follows
and in your activity(MyActivity.java) please override the method “onConfigurationChanged(Configuration configuration)” as follows
This should solve your problem