So, record the core code:
Copy the codeThe code is as follows:
DisplayMetrics metrics=new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
Get the resolution of the machine:
Copy the codeThe code is as follows:
int widthPixels=;
int heightPixels=;
Of course, you can directly display it with TextView, and you can also use it directly!