I want to get screen size via C. I know we can use JNI to call Java from c. But is there any way to get via C directly? I mean get screen size from lowlevel modules without calling Java but just C. I used these codes below(copy form https://stackoverflow.com/questions/12131429/android-get-screen-size-via-c), but doesn't work, it returns width:10925409 and height:0:
// ... Other standard includes ...
struct fb_var_screeninfo fb_var;
int fd = open("/dev/graphics/fb0", O_RDONLY);
ioctl(fd, FBIOGET_VSCREENINFO, &fb_var);
// screen size will be in fb_var.xres and fb_var.yres did you even google? stackoverflow.com/questions/12131429/â€¦
以上就是How to get the screen size of Android device via C?的详细内容，更多请关注web前端其它相关文章！