How to get screen dimensions in pixels in andorid devices?



How to get screen dimensions in pixels in andorid devices?..

Answer / Antul Awashthi

In Android, you can get screen dimensions by using DisplayMetrics. Here's a simple example: `DisplayMetrics metrics = new DisplayMetrics(); getApplicationContext().getResources().getDisplayMetrics(metrics); int width = metrics.widthPixels; int height = metrics.heightPixels;`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Android OS Interview Questions

What is up with all these different versions of android, like 'donut,' 'cupcake' and 'froyo'?

1 Answers  


What are the advantages of Android?

1 Answers   TryTechnicals Pvt Ltd,


Explain resource in android?

1 Answers  


How do you sync android with android?

1 Answers  


List few items, which you think may be important in every android project?

1 Answers  


what are the other notifications in android?

1 Answers  


How do you find any view element into your program?

1 Answers  


What is the difference between file, class, and activity in android?

1 Answers  


What is main/res/ directory?

1 Answers  


What is dagger in android?

1 Answers  


By default ui components made in the ui editor should have text defined in file?

1 Answers  


what is a handler thread?

1 Answers  


Categories