Android Studio 画面サイズの取得※旧バージョン
API29(Android10)までの方法
import android.widget.Toast;
import android.graphics.Point;
~~~
Point point = new Point();
this.getWindowManager().getDefaultDisplay().getRealSize(point);
int width = point.x;
int height = point.y;
Toast toast = Toast.makeText(this, "w="+point.x+" h="+point.y, Toast.LENGTH_LONG);
toast.show();