user1794058 user1794058 - 5 months ago 13
Android Question

Testing an Android device resolution using Robotium

Is there a way we can test an android device's resolution?

Answer

In any test function you can write following code:

    Activity ACT = getActivity();


    Display display = ACT.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    int width = size.x;
    int height = size.y;

or if API<13

Display display = getWindowManager().getDefaultDisplay(); 
int width = display.getWidth(); 
int height = display.getHeight();