emulation - Android emulator, creating and AVD with screenLayout = SIZE_LARGE -


this question has answer here:

i'm developing app targeting android 4+, behaves differently depending on screen size. more in detail:

  • on small/medium screens, orientation forced on portrait, , app runs switching activities.
  • on large/x-large screens, orientation forced on landscpe, screen split two, menu fragment on left, , other fragments on right.

problem is, can't create avd gets detected large screen.

just tested on avd 640x1024 resolution, 240 density, code never goes first if.

@override public void oncreate(bundle savedinstancestate) {      super.oncreate(savedinstancestate);      // forcing layout landscape if display large or more     if ((getresources().getconfiguration().screenlayout & configuration.screenlayout_size_mask) == configuration.screenlayout_size_large ||             (getresources().getconfiguration().screenlayout & configuration.screenlayout_size_mask) == configuration.screenlayout_size_xlarge) {         setrequestedorientation(activityinfo.screen_orientation_landscape);         dualpane = true;     }     else {         setrequestedorientation(activityinfo.screen_orientation_portrait);         dualpane = false;     } } 

any help?

assuming have android sdk plugins eclipse installed, can create emulator uses large layouts:

  1. in eclipse, click on little green android button (to "open android virtual device monitor").
  2. new...
  3. name = [whatever]
  4. target = android 4.x
  5. cpu/abi = [whatever] intel emulators better/faster.
  6. resolution = 1024 x 600. important part. don't use 600 x 1024. it must landscape device (like 'mini tablet')
  7. also important: set density manually mdpi: click on "abstracted lcd density" -> change number 160 mdpi.
  8. create avd

now start device. use large layouts (configuration.screenlayout_size_large). rotate portrait using ctrl+f11. portrait mode use large layouts.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -