Skip to content Skip to sidebar Skip to footer

Mapactivity - Width And Height Must Be > 0

i created an app using mapActivity and MapView and encounter the wierd message: ' E/AndroidRuntime(4276): java.lang.IllegalArgumentException: width and height must be > 0 ' that

Solution 1:

i think i got the answer, but i'm not sure, only time can tell with buggs like thoes. it seems as if i should not touch the screen on the onCreate while using google maps, so if i want to do ZoomIn or setZoom(SOME_NUMBER) then i should do it on the onResume() and not the onCreate. hope this will help someone, some day :) btw: if someone has an idea if it is realy the problem or is it just a temporery solution then i would like to hear, casue it seem to work fine with my solution :)

Solution 2:

You should do your changes in onWindowFocusChanged since you are not alloted screen height/width before that.

@Override
   public void onWindowFocusChanged(boolean hasFocus) {
      if (hasFocus) {
             setOverlay(); //Your code should come here
         }
      }
      super.onWindowFocusChanged(hasFocus);
   }

Post a Comment for "Mapactivity - Width And Height Must Be > 0"