android - How to detect when the device switch from portrait to landscape mode? -


i have app shows fullscreen bitmaps in activity. in order provide fast loading time, load them in memory. when screen changes orientation, clear cache in order fill again bitmaps fit inside new dimensions. problem in order this, need detect when orientation change occurs. know how detect this?

see official documentation http://developer.android.com/guide/topics/resources/runtime-changes.html

changing create new view , oncreate called again.

furthermore can check via

@override public void onconfigurationchanged(configuration newconfig) {     super.onconfigurationchanged(newconfig);      // checks orientation of screen     if (newconfig.orientation == configuration.orientation_landscape) {         toast.maketext(this, "landscape", toast.length_short).show();     } else if (newconfig.orientation == configuration.orientation_portrait){         toast.maketext(this, "portrait", toast.length_short).show();     } } 

Comments

Popular posts from this blog

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -