page.title=UiDevice
parent.title=uiautomator
parent.link=index.html
@jd:body
<style>
    h4.jd-details-title {background-color: #DEE8F1;}
</style>
<p>Provides access to state information about the device. You can
also use this class to simulate user actions on the device, such as pressing
the d-pad or pressing the Home and Menu buttons.</p>

<h2>Summary</h2>



























<!-- ========== METHOD SUMMARY =========== -->
<table id="pubmethods" class="jd-sumtable"><tr><th colspan="12">Public Methods</th></tr>




    <tr class="api" >
        <td class="jd-typecol"><nobr>





            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#clearLastTraversedText()">clearLastTraversedText</a></span>()</nobr>

        <div class="jd-descrdiv">Clears the text from the last UI traversal event.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#click(int, int)">click</a></span>(int x, int y)</nobr>

        <div class="jd-descrdiv">Perform a click at arbitrary coordinates specified by the user</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#drag(int, int, int, int, int)">drag</a></span>(int startX, int startY, int endX, int endY, int steps)</nobr>

        <div class="jd-descrdiv">Performs a swipe from one coordinate to another coordinate.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#dumpWindowHierarchy(java.lang.String)">dumpWindowHierarchy</a></span>(String fileName)</nobr>

        <div class="jd-descrdiv">Helper method used for debugging to dump the current window's layout hierarchy.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#freezeRotation()">freezeRotation</a></span>()</nobr>

        <div class="jd-descrdiv">Disables the sensors and freezes the device rotation at its
 current rotation state.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            String</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#getCurrentActivityName()">getCurrentActivityName</a></span>()</nobr>

        <div class="jd-descrdiv"><em>
      This method is deprecated.
    The results returned should be considered unreliable</em></div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            String</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#getCurrentPackageName()">getCurrentPackageName</a></span>()</nobr>

        <div class="jd-descrdiv">Retrieves the name of the last package to report accessibility events.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            int</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#getDisplayHeight()">getDisplayHeight</a></span>()</nobr>

        <div class="jd-descrdiv">Gets the height of the display, in pixels.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            int</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#getDisplayRotation()">getDisplayRotation</a></span>()</nobr>

        <div class="jd-descrdiv">Returns the current rotation of the display, as defined in <code><a href="../../../../../reference/android/view/Surface.html">Surface</a></code></div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            Point</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#getDisplaySizeDp()">getDisplaySizeDp</a></span>()</nobr>

        <div class="jd-descrdiv">Returns the display size in dp (device-independent pixel)

 The returned display size is adjusted per screen rotation.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            int</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#getDisplayWidth()">getDisplayWidth</a></span>()</nobr>

        <div class="jd-descrdiv">Gets the width of the display, in pixels.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>



            static

            <a href="#">UiDevice</a></nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#getInstance()">getInstance</a></span>()</nobr>

        <div class="jd-descrdiv">Retrieves a singleton instance of UiDevice</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            String</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#getLastTraversedText()">getLastTraversedText</a></span>()</nobr>

        <div class="jd-descrdiv">Retrieves the text from the last UI traversal event received.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            String</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#getProductName()">getProductName</a></span>()</nobr>

        <div class="jd-descrdiv">Retrieves the product name of the device.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#hasAnyWatcherTriggered()">hasAnyWatcherTriggered</a></span>()</nobr>

        <div class="jd-descrdiv">Checks if any registered <code><a href="UiWatcher.html">UiWatcher</a></code> have triggered.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#hasWatcherTriggered(java.lang.String)">hasWatcherTriggered</a></span>(String watcherName)</nobr>

        <div class="jd-descrdiv">Checks if a specific registered  <code><a href="UiWatcher.html">UiWatcher</a></code> has triggered.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#isNaturalOrientation()">isNaturalOrientation</a></span>()</nobr>

        <div class="jd-descrdiv">Check if the device is in its natural orientation.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#isScreenOn()">isScreenOn</a></span>()</nobr>

        <div class="jd-descrdiv">Checks the power manager if the screen is ON.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#openNotification()">openNotification</a></span>()</nobr>

        <div class="jd-descrdiv">Opens the notification shade.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#openQuickSettings()">openQuickSettings</a></span>()</nobr>

        <div class="jd-descrdiv">Opens the Quick Settings shade.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#pressBack()">pressBack</a></span>()</nobr>

        <div class="jd-descrdiv">Simulates a short press on the BACK button.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#pressDPadCenter()">pressDPadCenter</a></span>()</nobr>

        <div class="jd-descrdiv">Simulates a short press on the CENTER button.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#pressDPadDown()">pressDPadDown</a></span>()</nobr>

        <div class="jd-descrdiv">Simulates a short press on the DOWN button.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#pressDPadLeft()">pressDPadLeft</a></span>()</nobr>

        <div class="jd-descrdiv">Simulates a short press on the LEFT button.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#pressDPadRight()">pressDPadRight</a></span>()</nobr>

        <div class="jd-descrdiv">Simulates a short press on the RIGHT button.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#pressDPadUp()">pressDPadUp</a></span>()</nobr>

        <div class="jd-descrdiv">Simulates a short press on the UP button.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#pressDelete()">pressDelete</a></span>()</nobr>

        <div class="jd-descrdiv">Simulates a short press on the DELETE key.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#pressEnter()">pressEnter</a></span>()</nobr>

        <div class="jd-descrdiv">Simulates a short press on the ENTER key.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#pressHome()">pressHome</a></span>()</nobr>

        <div class="jd-descrdiv">Simulates a short press on the HOME button.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#pressKeyCode(int, int)">pressKeyCode</a></span>(int keyCode, int metaState)</nobr>

        <div class="jd-descrdiv">Simulates a short press using a key code.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#pressKeyCode(int)">pressKeyCode</a></span>(int keyCode)</nobr>

        <div class="jd-descrdiv">Simulates a short press using a key code.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#pressMenu()">pressMenu</a></span>()</nobr>

        <div class="jd-descrdiv">Simulates a short press on the MENU button.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#pressRecentApps()">pressRecentApps</a></span>()</nobr>

        <div class="jd-descrdiv">Simulates a short press on the Recent Apps button.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#pressSearch()">pressSearch</a></span>()</nobr>

        <div class="jd-descrdiv">Simulates a short press on the SEARCH button.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#registerWatcher(java.lang.String, com.android.uiautomator.core.UiWatcher)">registerWatcher</a></span>(String name, <a href="UiWatcher.html">UiWatcher</a> watcher)</nobr>

        <div class="jd-descrdiv">Registers a <code><a href="UiWatcher.html">UiWatcher</a></code> to run automatically when the testing framework is unable to
 find a match using a <code><a href="UiSelector.html">UiSelector</a></code>.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#removeWatcher(java.lang.String)">removeWatcher</a></span>(String name)</nobr>

        <div class="jd-descrdiv">Removes a previously registered <code><a href="UiWatcher.html">UiWatcher</a></code>.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#resetWatcherTriggers()">resetWatcherTriggers</a></span>()</nobr>

        <div class="jd-descrdiv">Resets a <code><a href="UiWatcher.html">UiWatcher</a></code> that has been triggered.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#runWatchers()">runWatchers</a></span>()</nobr>

        <div class="jd-descrdiv">This method forces all registered watchers to run.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#setCompressedLayoutHeirarchy(boolean)">setCompressedLayoutHeirarchy</a></span>(boolean compressed)</nobr>

        <div class="jd-descrdiv">Enables or disables layout hierarchy compression.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#setOrientationLeft()">setOrientationLeft</a></span>()</nobr>

        <div class="jd-descrdiv">Simulates orienting the device to the left and also freezes rotation
 by disabling the sensors.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#setOrientationNatural()">setOrientationNatural</a></span>()</nobr>

        <div class="jd-descrdiv">Simulates orienting the device into its natural orientation and also freezes rotation
 by disabling the sensors.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#setOrientationRight()">setOrientationRight</a></span>()</nobr>

        <div class="jd-descrdiv">Simulates orienting the device to the right and also freezes rotation
 by disabling the sensors.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#sleep()">sleep</a></span>()</nobr>

        <div class="jd-descrdiv">This method simply presses the power button if the screen is ON else
 it does nothing if the screen is already OFF.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#swipe(android.graphics.Point[], int)">swipe</a></span>(Point[] segments, int segmentSteps)</nobr>

        <div class="jd-descrdiv">Performs a swipe between points in the Point array.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#swipe(int, int, int, int, int)">swipe</a></span>(int startX, int startY, int endX, int endY, int steps)</nobr>

        <div class="jd-descrdiv">Performs a swipe from one coordinate to another using the number of steps
 to determine smoothness and speed.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#takeScreenshot(java.io.File)">takeScreenshot</a></span>(File storePath)</nobr>

        <div class="jd-descrdiv">Take a screenshot of current window and store it as PNG

 Default scale of 1.0f (original size) and 90% quality is used
 The screenshot is adjusted per screen rotation</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#takeScreenshot(java.io.File, float, int)">takeScreenshot</a></span>(File storePath, float scale, int quality)</nobr>

        <div class="jd-descrdiv">Take a screenshot of current window and store it as PNG

 The screenshot is adjusted per screen rotation</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#unfreezeRotation()">unfreezeRotation</a></span>()</nobr>

        <div class="jd-descrdiv">Re-enables the sensors and un-freezes the device rotation allowing its contents
 to rotate with the device physical rotation.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#waitForIdle(long)">waitForIdle</a></span>(long timeout)</nobr>

        <div class="jd-descrdiv">Waits for the current application to idle.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#waitForIdle()">waitForIdle</a></span>()</nobr>

        <div class="jd-descrdiv">Waits for the current application to idle.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#waitForWindowUpdate(java.lang.String, long)">waitForWindowUpdate</a></span>(String packageName, long timeout)</nobr>

        <div class="jd-descrdiv">Waits for a window content update event to occur.</div>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="#wakeUp()">wakeUp</a></span>()</nobr>

        <div class="jd-descrdiv">This method simulates pressing the power button if the screen is OFF else
 it does nothing if the screen is already ON.</div>

  </td></tr>



</table>







<!-- ========== METHOD SUMMARY =========== -->
<table id="inhmethods" class="jd-sumtable"><tr><th>
  <a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a>
  <div style="clear:left;">Inherited Methods</div></th></tr>


<tr class="api" >
<td colspan="12">
  <a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.Object" class="jd-expando-trigger closed"
          ><img id="inherited-methods-java.lang.Object-trigger"
          src="../../../../../assets/images/triangle-closed.png"
          class="jd-expando-trigger-img" /></a>
From class

  java.lang.Object

<div id="inherited-methods-java.lang.Object">
  <div id="inherited-methods-java.lang.Object-list"
        class="jd-inheritedlinks">
  </div>
  <div id="inherited-methods-java.lang.Object-summary" style="display: none;">
    <table class="jd-sumtable-expando">




    <tr class="api" >
        <td class="jd-typecol"><nobr>





            Object</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad">clone</span>()</nobr>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            boolean</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad">equals</span>(Object arg0)</nobr>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad">finalize</span>()</nobr>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>


            final


            Class&lt;?&gt;</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad">getClass</span>()</nobr>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            int</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad">hashCode</span>()</nobr>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>


            final


            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad">notify</span>()</nobr>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>


            final


            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad">notifyAll</span>()</nobr>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>





            String</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad">toString</span>()</nobr>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>


            final


            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad">wait</span>()</nobr>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>


            final


            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad">wait</span>(long arg0, int arg1)</nobr>

  </td></tr>



    <tr class="api" >
        <td class="jd-typecol"><nobr>


            final


            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad">wait</span>(long arg0)</nobr>

  </td></tr>


</table>
  </div>
</div>
</td></tr>


</table>


</div><!-- jd-descr (summary) -->

<!-- Details -->








<!-- XML Attributes -->


<!-- Enum Values -->


<!-- Constants -->


<!-- Fields -->


<!-- Public ctors -->



<!-- ========= CONSTRUCTOR DETAIL ======== -->
<!-- Protected ctors -->



<!-- ========= METHOD DETAIL ======== -->
<!-- Public methdos -->

<h2>Public Methods</h2>



<A NAME="clearLastTraversedText()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        void
      </span>
      <span class="sympad">clearLastTraversedText</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Clears the text from the last UI traversal event.
 See <code><a href="#getLastTraversedText()">getLastTraversedText()</a></code>.</p></div>

    </div>
</div>


<A NAME="click(int, int)"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">click</span>
      <span class="normal">(int x, int y)</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Perform a click at arbitrary coordinates specified by the user</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Parameters</h5>
      <table class="jd-tagtable">
        <tr>
          <th>x</td>
          <td>coordinate</td>
        </tr>
        <tr>
          <th>y</td>
          <td>coordinate</td>
        </tr>
      </table>
  </div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if the click succeeded else false</li></ul>
  </div>

    </div>
</div>


<A NAME="drag(int, int, int, int, int)"></A>

<div class="jd-details api apilevel-18">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">drag</span>
      <span class="normal">(int startX, int startY, int endX, int endY, int steps)</span>
    </h4>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Performs a swipe from one coordinate to another coordinate. You can control
 the smoothness and speed of the swipe by specifying the number of steps.
 Each step execution is throttled to 5 milliseconds per step, so for a 100
 steps, the swipe will take around 0.5 seconds to complete.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Parameters</h5>
      <table class="jd-tagtable">
        <tr>
          <th>startX</td>
          <td>X-axis value for the starting coordinate</td>
        </tr>
        <tr>
          <th>startY</td>
          <td>Y-axis value for the starting coordinate</td>
        </tr>
        <tr>
          <th>endX</td>
          <td>X-axis value for the ending coordinate</td>
        </tr>
        <tr>
          <th>endY</td>
          <td>Y-axis value for the ending coordinate</td>
        </tr>
        <tr>
          <th>steps</td>
          <td>is the number of steps for the swipe action</td>
        </tr>
      </table>
  </div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if swipe is performed, false if the operation fails
 or the coordinates are invalid</li></ul>
  </div>
  <div class="jd-tagdata">
     <h5 class="jd-tagtitle">Since</h5>
     <ul class="nolist"><li>Android API Level 18</li></ul>
  </div>
    </div>
</div>


<A NAME="dumpWindowHierarchy(java.lang.String)"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        void
      </span>
      <span class="sympad">dumpWindowHierarchy</span>
      <span class="normal">(String fileName)</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Helper method used for debugging to dump the current window's layout hierarchy.
 The file root location is /data/local/tmp</p></div>

    </div>
</div>


<A NAME="freezeRotation()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        void
      </span>
      <span class="sympad">freezeRotation</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Disables the sensors and freezes the device rotation at its
 current rotation state.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Throws</h5>
      <table class="jd-tagtable">
        <tr>
            <th></td>
            <td>RemoteException</td>
        </tr>
        <tr>
            <th>RemoteException</td>
            <td></td>
        </tr>
      </table>
  </div>

    </div>
</div>


<A NAME="getCurrentActivityName()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        String
      </span>
      <span class="sympad">getCurrentActivityName</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">
      <p>
  <p class="caution"><strong>
      This method is deprecated.</strong><br/>
    The results returned should be considered unreliable
  </p>
  <div class="jd-tagdata jd-tagdescr"><p>Retrieves the last activity to report accessibility events.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>String name of activity</li></ul>
  </div>

    </div>
</div>


<A NAME="getCurrentPackageName()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        String
      </span>
      <span class="sympad">getCurrentPackageName</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Retrieves the name of the last package to report accessibility events.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>String name of package</li></ul>
  </div>

    </div>
</div>


<A NAME="getDisplayHeight()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        int
      </span>
      <span class="sympad">getDisplayHeight</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Gets the height of the display, in pixels. The size is adjusted based
 on the current orientation of the display.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>height in pixels or zero on failure</li></ul>
  </div>

    </div>
</div>


<A NAME="getDisplayRotation()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        int
      </span>
      <span class="sympad">getDisplayRotation</span>
      <span class="normal">()</span>
    </h4>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Returns the current rotation of the display, as defined in <code><a href="../../../../../reference/android/view/Surface.html">Surface</a></code></p></div>

    </div>
    <div class="jd-tagdata">
     <h5 class="jd-tagtitle">Since</h5>
     <ul class="nolist"><li>Android API Level 17</li></ul>
  </div>
</div>


<A NAME="getDisplaySizeDp()"></A>

<div class="jd-details api apilevel-18">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        Point
      </span>
      <span class="sympad">getDisplaySizeDp</span>
      <span class="normal">()</span>
    </h4>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Returns the display size in dp (device-independent pixel)

 The returned display size is adjusted per screen rotation. Also this will return the actual
 size of the screen, rather than adjusted per system decorations (like status bar).</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>a Point containing the display size in dp
</li></ul>
  </div>
  <div class="jd-tagdata">
     <h5 class="jd-tagtitle">Since</h5>
     <ul class="nolist"><li>Android API Level 18</li></ul>
  </div>
    </div>
</div>


<A NAME="getDisplayWidth()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        int
      </span>
      <span class="sympad">getDisplayWidth</span>
      <span class="normal">()</span>
    </h4>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Gets the width of the display, in pixels. The width and height details
 are reported based on the current orientation of the display.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>width in pixels or zero on failure</li></ul>
  </div>

    </div>
</div>


<A NAME="getInstance()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public
        static



        <a href="#">UiDevice</a>
      </span>
      <span class="sympad">getInstance</span>
      <span class="normal">()</span>
    </h4>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Retrieves a singleton instance of UiDevice</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>UiDevice instance</li></ul>
  </div>

    </div>
</div>


<A NAME="getLastTraversedText()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        String
      </span>
      <span class="sympad">getLastTraversedText</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Retrieves the text from the last UI traversal event received.

 You can use this method to read the contents in a WebView container
 because the accessibility framework fires events
 as each text is highlighted. You can write a test to perform
 directional arrow presses to focus on different elements inside a WebView,
 and call this method to get the text from each traversed element.
 If you are testing a view container that can return a reference to a
 Document Object Model (DOM) object, your test should use the view's
 DOM instead.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>text of the last traversal event, else return an empty string</li></ul>
  </div>

    </div>
</div>


<A NAME="getProductName()"></A>

<div class="jd-details api apilevel-17">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        String
      </span>
      <span class="sympad">getProductName</span>
      <span class="normal">()</span>
    </h4>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Retrieves the product name of the device.

 This method provides information on what type of device the test is running on. This value is
 the same as returned by invoking #adb shell getprop ro.product.name.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>product name of the device</li></ul>
  </div>
  <div class="jd-tagdata">
     <h5 class="jd-tagtitle">Since</h5>
     <ul class="nolist"><li>Android API Level 17</li></ul>
  </div>
    </div>
</div>


<A NAME="hasAnyWatcherTriggered()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">hasAnyWatcherTriggered</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Checks if any registered <code><a href="UiWatcher.html">UiWatcher</a></code> have triggered.

 See <code><a href="#registerWatcher(java.lang.String, com.android.uiautomator.core.UiWatcher)">registerWatcher(String, UiWatcher)</a></code>
 See <code><a href="#hasWatcherTriggered(java.lang.String)">hasWatcherTriggered(String)</a></code></p></div>

    </div>
</div>


<A NAME="hasWatcherTriggered(java.lang.String)"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">hasWatcherTriggered</span>
      <span class="normal">(String watcherName)</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Checks if a specific registered  <code><a href="UiWatcher.html">UiWatcher</a></code> has triggered.
 See <code><a href="#registerWatcher(java.lang.String, com.android.uiautomator.core.UiWatcher)">registerWatcher(String, UiWatcher)</a></code>. If a UiWatcher runs and its
 <code><a href="UiWatcher.html#checkForCondition()">checkForCondition()</a></code> call returned <code>true</code>, then
 the UiWatcher is considered triggered. This is helpful if a watcher is detecting errors
 from ANR or crash dialogs and the test needs to know if a UiWatcher has been triggered.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if triggered else false</li></ul>
  </div>

    </div>
</div>


<A NAME="isNaturalOrientation()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">isNaturalOrientation</span>
      <span class="normal">()</span>
    </h4>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Check if the device is in its natural orientation. This is determined by checking if the
 orientation is at 0 or 180 degrees.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if it is in natural orientation</li></ul>
  </div>
  <div class="jd-tagdata">
     <h5 class="jd-tagtitle">Since</h5>
     <ul class="nolist"><li>Android API Level 17</li></ul>
  </div>
    </div>
</div>


<A NAME="isScreenOn()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">isScreenOn</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Checks the power manager if the screen is ON.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if the screen is ON else false</li></ul>
  </div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Throws</h5>
      <table class="jd-tagtable">
        <tr>
            <th></td>
            <td>RemoteException</td>
        </tr>
        <tr>
            <th>RemoteException</td>
            <td></td>
        </tr>
      </table>
  </div>

    </div>
</div>


<A NAME="openNotification()"></A>

<div class="jd-details api apilevel-18">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">openNotification</span>
      <span class="normal">()</span>
    </h4>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Opens the notification shade.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if successful, else return false</li></ul>
  </div>
  <div class="jd-tagdata">
     <h5 class="jd-tagtitle">Since</h5>
     <ul class="nolist"><li>Android API Level 18</li></ul>
  </div>
    </div>
</div>


<A NAME="openQuickSettings()"></A>

<div class="jd-details api apilevel-18">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">openQuickSettings</span>
      <span class="normal">()</span>
    </h4>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Opens the Quick Settings shade.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if successful, else return false</li></ul>
  </div>
  <div class="jd-tagdata">
     <h5 class="jd-tagtitle">Since</h5>
     <ul class="nolist"><li>Android API Level 18</li></ul>
  </div>
    </div>
</div>


<A NAME="pressBack()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">pressBack</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Simulates a short press on the BACK button.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if successful, else return false</li></ul>
  </div>

    </div>
</div>


<A NAME="pressDPadCenter()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">pressDPadCenter</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Simulates a short press on the CENTER button.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if successful, else return false</li></ul>
  </div>

    </div>
</div>


<A NAME="pressDPadDown()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">pressDPadDown</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Simulates a short press on the DOWN button.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if successful, else return false</li></ul>
  </div>

    </div>
</div>


<A NAME="pressDPadLeft()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">pressDPadLeft</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Simulates a short press on the LEFT button.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if successful, else return false</li></ul>
  </div>

    </div>
</div>


<A NAME="pressDPadRight()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">pressDPadRight</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Simulates a short press on the RIGHT button.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if successful, else return false</li></ul>
  </div>

    </div>
</div>


<A NAME="pressDPadUp()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">pressDPadUp</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Simulates a short press on the UP button.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if successful, else return false</li></ul>
  </div>

    </div>
</div>


<A NAME="pressDelete()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">pressDelete</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Simulates a short press on the DELETE key.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if successful, else return false</li></ul>
  </div>

    </div>
</div>


<A NAME="pressEnter()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">pressEnter</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Simulates a short press on the ENTER key.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if successful, else return false</li></ul>
  </div>

    </div>
</div>


<A NAME="pressHome()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">pressHome</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Simulates a short press on the HOME button.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if successful, else return false</li></ul>
  </div>

    </div>
</div>


<A NAME="pressKeyCode(int, int)"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">pressKeyCode</span>
      <span class="normal">(int keyCode, int metaState)</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Simulates a short press using a key code.

 See <code><a href="../../../../../reference/android/view/KeyEvent.html">KeyEvent</a></code>.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Parameters</h5>
      <table class="jd-tagtable">
        <tr>
          <th>keyCode</td>
          <td>the key code of the event.</td>
        </tr>
        <tr>
          <th>metaState</td>
          <td>an integer in which each bit set to 1 represents a pressed meta key</td>
        </tr>
      </table>
  </div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if successful, else return false</li></ul>
  </div>

    </div>
</div>


<A NAME="pressKeyCode(int)"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">pressKeyCode</span>
      <span class="normal">(int keyCode)</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Simulates a short press using a key code.

 See <code><a href="../../../../../reference/android/view/KeyEvent.html">KeyEvent</a></code></p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if successful, else return false</li></ul>
  </div>

    </div>
</div>


<A NAME="pressMenu()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">pressMenu</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Simulates a short press on the MENU button.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if successful, else return false</li></ul>
  </div>

    </div>
</div>


<A NAME="pressRecentApps()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">pressRecentApps</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Simulates a short press on the Recent Apps button.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if successful, else return false</li></ul>
  </div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Throws</h5>
      <table class="jd-tagtable">
        <tr>
            <th></td>
            <td>RemoteException</td>
        </tr>
        <tr>
            <th>RemoteException</td>
            <td></td>
        </tr>
      </table>
  </div>

    </div>
</div>


<A NAME="pressSearch()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">pressSearch</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Simulates a short press on the SEARCH button.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if successful, else return false</li></ul>
  </div>

    </div>
</div>


<A NAME="registerWatcher(java.lang.String, com.android.uiautomator.core.UiWatcher)"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        void
      </span>
      <span class="sympad">registerWatcher</span>
      <span class="normal">(String name, <a href="UiWatcher.html">UiWatcher</a> watcher)</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Registers a <code><a href="UiWatcher.html">UiWatcher</a></code> to run automatically when the testing framework is unable to
 find a match using a <code><a href="UiSelector.html">UiSelector</a></code>. See <code><a href="#runWatchers()">runWatchers()</a></code></p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Parameters</h5>
      <table class="jd-tagtable">
        <tr>
          <th>name</td>
          <td>to register the UiWatcher</td>
        </tr>
        <tr>
          <th>watcher</td>
          <td><code><a href="UiWatcher.html">UiWatcher</a></code></td>
        </tr>
      </table>
  </div>

    </div>
</div>


<A NAME="removeWatcher(java.lang.String)"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        void
      </span>
      <span class="sympad">removeWatcher</span>
      <span class="normal">(String name)</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Removes a previously registered <code><a href="UiWatcher.html">UiWatcher</a></code>.

 See <code><a href="#registerWatcher(java.lang.String, com.android.uiautomator.core.UiWatcher)">registerWatcher(String, UiWatcher)</a></code></p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Parameters</h5>
      <table class="jd-tagtable">
        <tr>
          <th>name</td>
          <td>used to register the UiWatcher</td>
        </tr>
      </table>
  </div>

    </div>
</div>


<A NAME="resetWatcherTriggers()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        void
      </span>
      <span class="sympad">resetWatcherTriggers</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Resets a <code><a href="UiWatcher.html">UiWatcher</a></code> that has been triggered.
 If a UiWatcher runs and its <code><a href="UiWatcher.html#checkForCondition()">checkForCondition()</a></code> call
 returned <code>true</code>, then the UiWatcher is considered triggered.
 See <code><a href="#registerWatcher(java.lang.String, com.android.uiautomator.core.UiWatcher)">registerWatcher(String, UiWatcher)</a></code></p></div>

    </div>
</div>


<A NAME="runWatchers()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        void
      </span>
      <span class="sympad">runWatchers</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>This method forces all registered watchers to run.
 See <code><a href="#registerWatcher(java.lang.String, com.android.uiautomator.core.UiWatcher)">registerWatcher(String, UiWatcher)</a></code></p></div>

    </div>
</div>


<A NAME="setCompressedLayoutHeirarchy(boolean)"></A>

<div class="jd-details api apilevel-18">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        void
      </span>
      <span class="sympad">setCompressedLayoutHeirarchy</span>
      <span class="normal">(boolean compressed)</span>
    </h4>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Enables or disables layout hierarchy compression.

 If compression is enabled, the layout hierarchy derived from the Acessibility
 framework will only contain nodes that are important for uiautomator
 testing. Any unnecessary surrounding layout nodes that make viewing
 and searching the hierarchy inefficient are removed.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Parameters</h5>
      <table class="jd-tagtable">
        <tr>
          <th>compressed</td>
          <td>true to enable compression; else, false to disable</td>
        </tr>
      </table>
  </div>
  <div class="jd-tagdata">
     <h5 class="jd-tagtitle">Since</h5>
     <ul class="nolist"><li>Android API Level 18</li></ul>
  </div>
    </div>
</div>


<A NAME="setOrientationLeft()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        void
      </span>
      <span class="sympad">setOrientationLeft</span>
      <span class="normal">()</span>
    </h4>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Simulates orienting the device to the left and also freezes rotation
 by disabling the sensors.

 If you want to un-freeze the rotation and re-enable the sensors
 see <code><a href="#unfreezeRotation()">unfreezeRotation()</a></code>.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Throws</h5>
      <table class="jd-tagtable">
        <tr>
            <th></td>
            <td>RemoteException</td>
        </tr>
        <tr>
            <th>RemoteException</td>
            <td></td>
        </tr>
      </table>
  </div>
  <div class="jd-tagdata">
     <h5 class="jd-tagtitle">Since</h5>
     <ul class="nolist"><li>Android API Level 17</li></ul>
  </div>
    </div>
</div>


<A NAME="setOrientationNatural()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        void
      </span>
      <span class="sympad">setOrientationNatural</span>
      <span class="normal">()</span>
    </h4>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Simulates orienting the device into its natural orientation and also freezes rotation
 by disabling the sensors.

 If you want to un-freeze the rotation and re-enable the sensors
 see <code><a href="#unfreezeRotation()">unfreezeRotation()</a></code>.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Throws</h5>
      <table class="jd-tagtable">
        <tr>
            <th></td>
            <td>RemoteException</td>
        </tr>
        <tr>
            <th>RemoteException</td>
            <td></td>
        </tr>
      </table>
  </div>
  <div class="jd-tagdata">
     <h5 class="jd-tagtitle">Since</h5>
     <ul class="nolist"><li>Android API Level 17</li></ul>
  </div>
    </div>
</div>


<A NAME="setOrientationRight()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        void
      </span>
      <span class="sympad">setOrientationRight</span>
      <span class="normal">()</span>
    </h4>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Simulates orienting the device to the right and also freezes rotation
 by disabling the sensors.

 If you want to un-freeze the rotation and re-enable the sensors
 see <code><a href="#unfreezeRotation()">unfreezeRotation()</a></code>.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Throws</h5>
      <table class="jd-tagtable">
        <tr>
            <th></td>
            <td>RemoteException</td>
        </tr>
        <tr>
            <th>RemoteException</td>
            <td></td>
        </tr>
      </table>
  </div>
  <div class="jd-tagdata">
     <h5 class="jd-tagtitle">Since</h5>
     <ul class="nolist"><li>Android API Level 17</li></ul>
  </div>
    </div>
</div>


<A NAME="sleep()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        void
      </span>
      <span class="sympad">sleep</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>This method simply presses the power button if the screen is ON else
 it does nothing if the screen is already OFF.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Throws</h5>
      <table class="jd-tagtable">
        <tr>
            <th></td>
            <td>RemoteException</td>
        </tr>
        <tr>
            <th>RemoteException</td>
            <td></td>
        </tr>
      </table>
  </div>

    </div>
</div>


<A NAME="swipe(android.graphics.Point[], int)"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">swipe</span>
      <span class="normal">(Point[] segments, int segmentSteps)</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Performs a swipe between points in the Point array. Each step execution is throttled
 to 5ms per step. So for a 100 steps, the swipe will take about 1/2 second to complete</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Parameters</h5>
      <table class="jd-tagtable">
        <tr>
          <th>segments</td>
          <td>is Point array containing at least one Point object</td>
        </tr>
        <tr>
          <th>segmentSteps</td>
          <td>steps to inject between two Points</td>
        </tr>
      </table>
  </div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true on success</li></ul>
  </div>

    </div>
</div>


<A NAME="swipe(int, int, int, int, int)"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">swipe</span>
      <span class="normal">(int startX, int startY, int endX, int endY, int steps)</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Performs a swipe from one coordinate to another using the number of steps
 to determine smoothness and speed. Each step execution is throttled to 5ms
 per step. So for a 100 steps, the swipe will take about 1/2 second to complete.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Parameters</h5>
      <table class="jd-tagtable">
        <tr>
          <th>steps</td>
          <td>is the number of move steps sent to the system</td>
        </tr>
      </table>
  </div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>false if the operation fails or the coordinates are invalid</li></ul>
  </div>

    </div>
</div>


<A NAME="takeScreenshot(java.io.File)"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">takeScreenshot</span>
      <span class="normal">(File storePath)</span>
    </h4>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Take a screenshot of current window and store it as PNG

 Default scale of 1.0f (original size) and 90% quality is used
 The screenshot is adjusted per screen rotation</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Parameters</h5>
      <table class="jd-tagtable">
        <tr>
          <th>storePath</td>
          <td>where the PNG should be written to</td>
        </tr>
      </table>
  </div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if screen shot is created successfully, false otherwise</li></ul>
  </div>
  <div class="jd-tagdata">
     <h5 class="jd-tagtitle">Since</h5>
     <ul class="nolist"><li>Android API Level 17</li></ul>
  </div>
    </div>
</div>


<A NAME="takeScreenshot(java.io.File, float, int)"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">takeScreenshot</span>
      <span class="normal">(File storePath, float scale, int quality)</span>
    </h4>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Take a screenshot of current window and store it as PNG

 The screenshot is adjusted per screen rotation</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Parameters</h5>
      <table class="jd-tagtable">
        <tr>
          <th>storePath</td>
          <td>where the PNG should be written to</td>
        </tr>
        <tr>
          <th>scale</td>
          <td>scale the screenshot down if needed; 1.0f for original size</td>
        </tr>
        <tr>
          <th>quality</td>
          <td>quality of the PNG compression; range: 0-100</td>
        </tr>
      </table>
  </div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if screen shot is created successfully, false otherwise</li></ul>
  </div>
  <div class="jd-tagdata">
     <h5 class="jd-tagtitle">Since</h5>
     <ul class="nolist"><li>Android API Level 17</li></ul>
  </div>
    </div>
</div>


<A NAME="unfreezeRotation()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        void
      </span>
      <span class="sympad">unfreezeRotation</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Re-enables the sensors and un-freezes the device rotation allowing its contents
 to rotate with the device physical rotation. During a test execution, it is best to
 keep the device frozen in a specific orientation until the test case execution has completed.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Throws</h5>
      <table class="jd-tagtable">
        <tr>
            <th>RemoteException</td>
            <td></td>
        </tr>
      </table>
  </div>

    </div>
</div>


<A NAME="waitForIdle(long)"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        void
      </span>
      <span class="sympad">waitForIdle</span>
      <span class="normal">(long timeout)</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Waits for the current application to idle.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Parameters</h5>
      <table class="jd-tagtable">
        <tr>
          <th>timeout</td>
          <td>in milliseconds</td>
        </tr>
      </table>
  </div>

    </div>
</div>


<A NAME="waitForIdle()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        void
      </span>
      <span class="sympad">waitForIdle</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Waits for the current application to idle.
 Default wait timeout is 10 seconds</p></div>

    </div>
</div>


<A NAME="waitForWindowUpdate(java.lang.String, long)"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        boolean
      </span>
      <span class="sympad">waitForWindowUpdate</span>
      <span class="normal">(String packageName, long timeout)</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>Waits for a window content update event to occur.

 If a package name for the window is specified, but the current window
 does not have the same package name, the function returns immediately.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Parameters</h5>
      <table class="jd-tagtable">
        <tr>
          <th>packageName</td>
          <td>the specified window package name (can be <code>null</code>).
        If <code>null</code>, a window update from any front-end window will end the wait</td>
        </tr>
        <tr>
          <th>timeout</td>
          <td>the timeout for the wait</td>
        </tr>
      </table>
  </div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if a window update occurred, false if timeout has elapsed or if the current
         window does not have the specified package name</li></ul>
  </div>

    </div>
</div>


<A NAME="wakeUp()"></A>

<div class="jd-details api">
    <h4 class="jd-details-title">
      <span class="normal">
        public




        void
      </span>
      <span class="sympad">wakeUp</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div></div>



      </div>
    <div class="jd-details-descr">

  <div class="jd-tagdata jd-tagdescr"><p>This method simulates pressing the power button if the screen is OFF else
 it does nothing if the screen is already ON.

 If the screen was OFF and it just got turned ON, this method will insert a 500ms delay
 to allow the device time to wake up and accept input.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Throws</h5>
      <table class="jd-tagtable">
        <tr>
            <th></td>
            <td>RemoteException</td>
        </tr>
        <tr>
            <th>RemoteException</td>
            <td></td>
        </tr>
      </table>
  </div>

    </div>





<!-- ========= METHOD DETAIL ======== -->




