[Solved] android: does anyone see a – componentinfo java.lang.nullpointerexception? [closed]


You are getting your null pointer exception on 21 and below because getHeight and getWidth were added then. Try this ;

if (  Integer.valueOf(android.os.Build.VERSION.SDK_INT) < 13 ) {
     Display display = getWindowManager().getDefaultDisplay(); 
     int width = display.getWidth();
     int height = display.getHeight();
   } else {
       Display display = getWindowManager().getDefaultDisplay();
          Point size = new Point();
          display.getSize(size);
          int width = size.x;
          int height = size.y;
   }

You may need to play around with the API level (I can’t remember what 2.1 is)

2

solved android: does anyone see a – componentinfo java.lang.nullpointerexception? [closed]