199 페이지의 소스코드가 잘못 들어가 있네요.
아래의 코드로 변경되어야 합니다.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
WindowMetrics windowMetrics = getWindowManager().getCurrentWindowMetrics();
int width = windowMetrics.getBounds().width();
int height = windowMetrics.getBounds().height();
binding.textView.setText("width : "+width+", height : "+height);
} else {
Display display = getWindowManager().getDefaultDisplay();
DisplayMetrics displayMetrics = new DisplayMetrics();
display.getRealMetrics(displayMetrics);
int width = displayMetrics.widthPixels;
int height = displayMetrics.heightPixels;
binding.textView.setText("width:"+width+", height:"+height);
}
'2022-쌤즈-자바-깡쌤의 안드로이드 프로그래밍 with 자바' 카테고리의 다른 글
저자 직강 - [쌤즈] 깡쌤의 안드로이드 프로그래밍 with 자바 (0) | 2022.05.30 |
---|---|
쌤즈-자바-깡쌤 안드로이드-2022-교재에 담긴 실습 코드 (0) | 2022.04.26 |
쌤즈-자바-실습 공유 파일 (0) | 2022.04.26 |