Monday, 12 August 2013

display metrics android(device width zero initially)

Plz add the following to the application oncreate method to get width and height of device




        ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE))
          .getDefaultDisplay().getMetrics(displayMetrics);


DisplayMetrics met =  new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(met);
        System.out.println("here  "+met.widthPixels);
        System.out.println("here height is "+met.heightPixels);

No comments:

Post a Comment

Pass a HashMap from Angular Client to Spring boot API

This example is for the case where fileData is very huge and in json format   let map = new Map<string, string>()      map.set(this.ge...