Search code examples
androidrobotium

How to get the zoom level of a mapview in Android when writing the test cases using solo in Robotium


I am working on Robotium to perform an automation test an Android application. in side the application a map view has to get the zoom levels. Can any one explain how to get the zoom level of a map view by using Solo Object in Robotium tool?


Solution

  • Try something like this:

    MapView map = (MapView)solo.getCurrentActivity().findViewById(your.package.name.R.id.google_maps);
    int zoom = map.getZoomLevel();
    

    I just tried this on my robotium testcase and it worked. Also, you should try accepting answers, you'll get better/more responses! Good luck