1

i am new in android development. i have some difficulty about android screen size.

1 ) how to get my current application windows size .

ex: height = h px, width = w px

2 ) how to call back when windows size change. like when keyboard open then window size change but how to measure how change where is call back function.

ex: height = ( h - keyboardHeight ) px
    height = ( w - keyboardWidth ) px

1 . first image ( find red background size)

2 . second image ( open keyboard find and call back of red background size)

pathik devani
  • 530
  • 5
  • 13

1 Answers1

1
  1. getResources().getDisplayMetrics().heightPixels x getResources().getDisplayMetrics().widthPixels

  2. Take a look here: https://stackoverflow.com/a/5473245/517381

Community
  • 1
  • 1
ViliusK
  • 11,345
  • 4
  • 67
  • 71