1<!DOCTYPE html> 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96<html> 97<head> 98 99 100<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 101<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" /> 102<meta content="IE=edge" http-equiv="X-UA-Compatible"> 103 104<link rel="shortcut icon" type="image/x-icon" href="../../../../../favicon.ico" /> 105<title>ViewAssertion | Android Developers</title> 106 107<!-- STYLESHEETS --> 108<link rel="stylesheet" 109href="http://fonts.googleapis.com/css?family=Roboto+Condensed"> 110<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold" 111 title="roboto"> 112 113<link href="../../../../../assets/css/default.css?v=7" rel="stylesheet" type="text/css"> 114 115 116<!-- FULLSCREEN STYLESHEET --> 117<link href="../../../../../assets/css/fullscreen.css" rel="stylesheet" class="fullscreen" 118type="text/css"> 119 120 121<!-- JAVASCRIPT --> 122<script src="http://www.google.com/jsapi" type="text/javascript"></script> 123<script src="../../../../../assets/js/android_3p-bundle.js" type="text/javascript"></script> 124<script type="text/javascript"> 125 var toRoot = "../../../../../"; 126 var metaTags = []; 127 var devsite = false; 128</script> 129<script src="../../../../../assets/js/docs.js?v=5" type="text/javascript"></script> 130 131 132 133<script> 134 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 135 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 136 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 137 })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); 138 139 ga('create', 'UA-5831155-1', 'android.com'); 140 ga('create', 'UA-49880327-2', 'android.com', {'name': 'universal'}); // New tracker); 141 ga('send', 'pageview'); 142 ga('universal.send', 'pageview'); // Send page view for new tracker. 143</script> 144 145</head> 146 147<body class="gc-documentation 148 develop reference" itemscope itemtype="http://schema.org/Article"> 149 <div id="doc-api-level" class="" style="display:none"></div> 150 <a name="top"></a> 151 152<a name="top"></a> 153 154<!-- dialog to prompt lang pref change when loaded from hardcoded URL 155<div id="langMessage" style="display:none"> 156 <div> 157 <div class="lang en"> 158 <p>You requested a page in English, would you like to proceed with this language setting?</p> 159 </div> 160 <div class="lang es"> 161 <p>You requested a page in Spanish (Español), would you like to proceed with this language setting?</p> 162 </div> 163 <div class="lang ja"> 164 <p>You requested a page in Japanese (日本語), would you like to proceed with this language setting?</p> 165 </div> 166 <div class="lang ko"> 167 <p>You requested a page in Korean (한국어), would you like to proceed with this language setting?</p> 168 </div> 169 <div class="lang ru"> 170 <p>You requested a page in Russian (Русский), would you like to proceed with this language setting?</p> 171 </div> 172 <div class="lang zh-cn"> 173 <p>You requested a page in Simplified Chinese (简体中文), would you like to proceed with this language setting?</p> 174 </div> 175 <div class="lang zh-tw"> 176 <p>You requested a page in Traditional Chinese (繁體中文), would you like to proceed with this language setting?</p> 177 </div> 178 <a href="#" class="button yes" onclick="return false;"> 179 <span class="lang en">Yes</span> 180 <span class="lang es">Sí</span> 181 <span class="lang ja">Yes</span> 182 <span class="lang ko">Yes</span> 183 <span class="lang ru">Yes</span> 184 <span class="lang zh-cn">是的</span> 185 <span class="lang zh-tw">没有</span> 186 </a> 187 <a href="#" class="button" onclick="$('#langMessage').hide();return false;"> 188 <span class="lang en">No</span> 189 <span class="lang es">No</span> 190 <span class="lang ja">No</span> 191 <span class="lang ko">No</span> 192 <span class="lang ru">No</span> 193 <span class="lang zh-cn">没有</span> 194 <span class="lang zh-tw">没有</span> 195 </a> 196 </div> 197</div> --> 198 199 200 <!-- Header --> 201 <div id="header-wrapper"> 202 <div class="dac-header" id="header"> 203 204 205 206 207 <div class="dac-header-inner"> 208 <a class="dac-nav-toggle" data-dac-toggle-nav href="javascript:;" title="Open navigation"> 209 <span class="dac-nav-hamburger"> 210 <span class="dac-nav-hamburger-top"></span> 211 <span class="dac-nav-hamburger-mid"></span> 212 <span class="dac-nav-hamburger-bot"></span> 213 </span> 214 </a> 215 <a class="dac-header-logo" href="../../../../../index.html"> 216 <img class="dac-header-logo-image" src="../../../../../assets/images/android_logo.png" 217 srcset="../../../../../assets/images/android_logo@2x.png 2x" 218 width="32" height="36" alt="Android" /> Developers 219 </a> 220 221 <ul class="dac-header-crumbs"> 222 223 <li class="dac-header-crumbs-item"><span class="dac-header-crumbs-link current ">ViewAssertion</a></li> 224 </ul> 225 226 227 228 229 <div class="dac-header-search" id="search-container"> 230 <div class="dac-header-search-inner"> 231 <div class="dac-sprite dac-search dac-header-search-btn" id="search-btn"></div> 232 <form class="dac-header-search-form" onsubmit="return submit_search()"> 233 <input id="search_autocomplete" type="text" value="" autocomplete="off" name="q" 234 onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)" 235 onkeydown="return search_changed(event, true, '../../../../../')" 236 onkeyup="return search_changed(event, false, '../../../../../')" 237 class="dac-header-search-input" placeholder="Search" /> 238 <a class="dac-header-search-close hide" id="search-close">close</a> 239 </form> 240 </div><!-- end dac-header-search-inner --> 241 </div><!-- end dac-header-search --> 242 243 <div class="search_filtered_wrapper"> 244 <div class="suggest-card reference no-display"> 245 <ul class="search_filtered"> 246 </ul> 247 </div> 248 <div class="suggest-card develop no-display"> 249 <ul class="search_filtered"> 250 </ul> 251 <div class="child-card guides no-display"> 252 </div> 253 <div class="child-card training no-display"> 254 </div> 255 <div class="child-card samples no-display"> 256 </div> 257 </div> 258 <div class="suggest-card design no-display"> 259 <ul class="search_filtered"> 260 </ul> 261 </div> 262 <div class="suggest-card distribute no-display"> 263 <ul class="search_filtered"> 264 </ul> 265 </div> 266 </div> 267 268 269 270 <a class="dac-header-console-btn" href="https://play.google.com/apps/publish/"> 271 <span class="dac-sprite dac-google-play"></span> 272 <span class="dac-visible-desktop-inline">Developer</span> 273 Console 274 </a> 275 276 </div><!-- end header-wrap.wrap --> 277 </div><!-- end header --> 278 279 <div id="searchResults" class="wrap" style="display:none;"> 280 <h2 id="searchTitle">Results</h2> 281 <div id="leftSearchControl" class="search-control">Loading...</div> 282 </div> 283 </div> <!--end header-wrapper --> 284 285 286 <!-- Navigation--> 287 <nav class="dac-nav"> 288 <div class="dac-nav-dimmer" data-dac-toggle-nav></div> 289 290 <ul class="dac-nav-list" data-dac-nav> 291 <li class="dac-nav-item dac-nav-head"> 292 <a class="dac-nav-link dac-nav-logo" data-dac-toggle-nav href="javascript:;" title="Close navigation"> 293 <img class="dac-logo-image" src="../../../../../assets/images/android_logo.png" 294 srcset="../../../../../assets/images/android_logo@2x.png 2x" 295 width="32" height="36" alt="Android" /> Developers 296 </a> 297 </li> 298 <li class="dac-nav-item home"> 299 <a class="dac-nav-link dac-visible-mobile-block" href="../../../../../index.html">Home</a> 300 <ul class="dac-nav-secondary about"> 301 <li class="dac-nav-item about"> 302 <a class="dac-nav-link" href="../../../../../about/index.html">Android</a> 303 </li> 304 <li class="dac-nav-item wear"> 305 <a class="dac-nav-link" href="../../../../../wear/index.html">Wear</a> 306 </li> 307 <li class="dac-nav-item tv"> 308 <a class="dac-nav-link" href="../../../../../tv/index.html">TV</a> 309 </li> 310 <li class="dac-nav-item auto"> 311 <a class="dac-nav-link" href="../../../../../auto/index.html">Auto</a> 312 </li> 313 </ul> 314 </li> 315 <li class="dac-nav-item design"> 316 <a class="dac-nav-link" href="../../../../../design/index.html" 317 zh-tw-lang="設計" 318 zh-cn-lang="设计" 319 ru-lang="Проектирование" 320 ko-lang="디자인" 321 ja-lang="設計" 322 es-lang="Diseñar">Design</a> 323 </li> 324 <li class="dac-nav-item develop"> 325 <a class="dac-nav-link" href="../../../../../develop/index.html" 326 zh-tw-lang="開發" 327 zh-cn-lang="开发" 328 ru-lang="Разработка" 329 ko-lang="개발" 330 ja-lang="開発" 331 es-lang="Desarrollar">Develop</a> 332 <ul class="dac-nav-secondary develop"> 333 <li class="dac-nav-item training"> 334 <a class="dac-nav-link" href="../../../../../training/index.html" 335 zh-tw-lang="訓練課程" 336 zh-cn-lang="培训" 337 ru-lang="Курсы" 338 ko-lang="교육" 339 ja-lang="トレーニング" 340 es-lang="Capacitación">Training</a> 341 </li> 342 <li class="dac-nav-item guide"> 343 <a class="dac-nav-link" href="../../../../../guide/index.html" 344 zh-tw-lang="API 指南" 345 zh-cn-lang="API 指南" 346 ru-lang="Руководства по API" 347 ko-lang="API 가이드" 348 ja-lang="API ガイド" 349 es-lang="Guías de la API">API Guides</a> 350 </li> 351 <li class="dac-nav-item reference"> 352 <a class="dac-nav-link" href="../../../../../reference/packages.html" 353 zh-tw-lang="參考資源" 354 zh-cn-lang="参考" 355 ru-lang="Справочник" 356 ko-lang="참조문서" 357 ja-lang="リファレンス" 358 es-lang="Referencia">Reference</a> 359 </li> 360 <li class="dac-nav-item tools"> 361 <a class="dac-nav-link" href="../../../../../sdk/index.html" 362 zh-tw-lang="相關工具" 363 zh-cn-lang="工具" 364 ru-lang="Инструменты" 365 ko-lang="도구" 366 ja-lang="ツール" 367 es-lang="Herramientas">Tools</a></li> 368 <li class="dac-nav-item google"> 369 <a class="dac-nav-link" href="../../../../../google/index.html">Google Services</a> 370 </li> 371 372 <li class="dac-nav-item preview"> 373 <a class="dac-nav-link" href="../../../../../preview/index.html">Preview</a> 374 </li> 375 </ul> 376 </li> 377 <li class="dac-nav-item distribute"> 378 <a class="dac-nav-link" href="../../../../../distribute/index.html" 379 zh-tw-lang="發佈" 380 zh-cn-lang="分发" 381 ru-lang="Распространение" 382 ko-lang="배포" 383 ja-lang="配布" 384 es-lang="Distribuir">Distribute</a> 385 <ul class="dac-nav-secondary distribute"> 386 <li class="dac-nav-item googleplay"> 387 <a class="dac-nav-link" href="../../../../../distribute/googleplay/index.html">Google Play</a></li> 388 <li class="dac-nav-item essentials"> 389 <a class="dac-nav-link" href="../../../../../distribute/essentials/index.html">Essentials</a></li> 390 <li class="dac-nav-item users"> 391 <a class="dac-nav-link" href="../../../../../distribute/users/index.html">Get Users</a></li> 392 <li class="dac-nav-item engage"> 393 <a class="dac-nav-link" href="../../../../../distribute/engage/index.html">Engage & Retain</a></li> 394 <li class="dac-nav-item monetize"> 395 <a class="dac-nav-link" href="../../../../../distribute/monetize/index.html">Earn</a> 396 </li> 397 <li class="dac-nav-item analyze"> 398 <a class="dac-nav-link" href="../../../../../distribute/analyze/index.html">Analyze</a> 399 </li> 400 <li class="dac-nav-item stories"> 401 <a class="dac-nav-link" href="../../../../../distribute/stories/index.html">Stories</a> 402 </li> 403 </ul> 404 </li> 405 </ul> 406 </nav> 407 <!-- end navigation--> 408 409 410 411 412 413 414 <div class="wrap clearfix" id="body-content"><div class="cols"> 415 <div class="col-4 dac-hidden-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement"> 416 <div id="devdoc-nav"> 417 <div id="api-nav-header"> 418 <div id="api-level-toggle"> 419 <label for="apiLevelCheckbox" class="disabled" 420 title="Select your target API level to dim unavailable APIs">API level: </label> 421 <div class="select-wrapper"> 422 <select id="apiLevelSelector"> 423 <!-- option elements added by buildApiLevelSelector() --> 424 </select> 425 </div> 426 </div><!-- end toggle --> 427 <div id="api-nav-title">Android APIs</div> 428 </div><!-- end nav header --> 429 <script> 430 var SINCE_DATA = [ ]; 431 buildApiLevelSelector(); 432 </script> 433 434 <div id="swapper"> 435 <div id="nav-panels"> 436 <div id="resize-packages-nav"> 437 <div id="packages-nav" class="scroll-pane"> 438 439 <ul> 440 441 <li class="api apilevel-"> 442 <a href="../../../../../reference/android/support/test/package-summary.html">android.support.test</a></li> 443 <li class="api apilevel-"> 444 <a href="../../../../../reference/android/support/test/annotation/package-summary.html">android.support.test.annotation</a></li> 445 <li class="selected api apilevel-"> 446 <a href="../../../../../reference/android/support/test/espresso/package-summary.html">android.support.test.espresso</a></li> 447 <li class="api apilevel-"> 448 <a href="../../../../../reference/android/support/test/espresso/action/package-summary.html">android.support.test.espresso.action</a></li> 449 <li class="api apilevel-"> 450 <a href="../../../../../reference/android/support/test/espresso/assertion/package-summary.html">android.support.test.espresso.assertion</a></li> 451 <li class="api apilevel-"> 452 <a href="../../../../../reference/android/support/test/espresso/base/package-summary.html">android.support.test.espresso.base</a></li> 453 <li class="api apilevel-"> 454 <a href="../../../../../reference/android/support/test/espresso/contrib/package-summary.html">android.support.test.espresso.contrib</a></li> 455 <li class="api apilevel-"> 456 <a href="../../../../../reference/android/support/test/espresso/intent/package-summary.html">android.support.test.espresso.intent</a></li> 457 <li class="api apilevel-"> 458 <a href="../../../../../reference/android/support/test/espresso/intent/matcher/package-summary.html">android.support.test.espresso.intent.matcher</a></li> 459 <li class="api apilevel-"> 460 <a href="../../../../../reference/android/support/test/espresso/intent/rule/package-summary.html">android.support.test.espresso.intent.rule</a></li> 461 <li class="api apilevel-"> 462 <a href="../../../../../reference/android/support/test/espresso/matcher/package-summary.html">android.support.test.espresso.matcher</a></li> 463 <li class="api apilevel-"> 464 <a href="../../../../../reference/android/support/test/espresso/util/package-summary.html">android.support.test.espresso.util</a></li> 465 <li class="api apilevel-"> 466 <a href="../../../../../reference/android/support/test/espresso/web/action/package-summary.html">android.support.test.espresso.web.action</a></li> 467 <li class="api apilevel-"> 468 <a href="../../../../../reference/android/support/test/espresso/web/assertion/package-summary.html">android.support.test.espresso.web.assertion</a></li> 469 <li class="api apilevel-"> 470 <a href="../../../../../reference/android/support/test/espresso/web/bridge/package-summary.html">android.support.test.espresso.web.bridge</a></li> 471 <li class="api apilevel-"> 472 <a href="../../../../../reference/android/support/test/espresso/web/matcher/package-summary.html">android.support.test.espresso.web.matcher</a></li> 473 <li class="api apilevel-"> 474 <a href="../../../../../reference/android/support/test/espresso/web/model/package-summary.html">android.support.test.espresso.web.model</a></li> 475 <li class="api apilevel-"> 476 <a href="../../../../../reference/android/support/test/espresso/web/sugar/package-summary.html">android.support.test.espresso.web.sugar</a></li> 477 <li class="api apilevel-"> 478 <a href="../../../../../reference/android/support/test/espresso/web/webdriver/package-summary.html">android.support.test.espresso.web.webdriver</a></li> 479 <li class="api apilevel-"> 480 <a href="../../../../../reference/android/support/test/filters/package-summary.html">android.support.test.filters</a></li> 481 <li class="api apilevel-"> 482 <a href="../../../../../reference/android/support/test/rule/package-summary.html">android.support.test.rule</a></li> 483 <li class="api apilevel-"> 484 <a href="../../../../../reference/android/support/test/runner/package-summary.html">android.support.test.runner</a></li> 485 <li class="api apilevel-"> 486 <a href="../../../../../reference/android/support/test/runner/intent/package-summary.html">android.support.test.runner.intent</a></li> 487 <li class="api apilevel-"> 488 <a href="../../../../../reference/android/support/test/runner/lifecycle/package-summary.html">android.support.test.runner.lifecycle</a></li> 489 <li class="api apilevel-"> 490 <a href="../../../../../reference/android/support/test/uiautomator/package-summary.html">android.support.test.uiautomator</a></li> 491 </ul><br/> 492 493 </div> <!-- end packages-nav --> 494 </div> <!-- end resize-packages --> 495 <div id="classes-nav" class="scroll-pane"> 496 497 498 499 <ul> 500 501 502 <li><h2>Interfaces</h2> 503 <ul> 504 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/BaseLayerComponent.html">BaseLayerComponent</a></li> 505 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/EspressoException.html">EspressoException</a></li> 506 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/FailureHandler.html">FailureHandler</a></li> 507 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/IdlingResource.html">IdlingResource</a></li> 508 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/IdlingResource.ResourceCallback.html">IdlingResource.ResourceCallback</a></li> 509 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/UiController.html">UiController</a></li> 510 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/ViewAction.html">ViewAction</a></li> 511 <li class="selected api apilevel-"><a href="../../../../../reference/android/support/test/espresso/ViewAssertion.html">ViewAssertion</a></li> 512 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/ViewFinder.html">ViewFinder</a></li> 513 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/ViewInteractionComponent.html">ViewInteractionComponent</a></li> 514 </ul> 515 </li> 516 517 <li><h2>Classes</h2> 518 <ul> 519 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/AmbiguousViewMatcherException.Builder.html">AmbiguousViewMatcherException.Builder</a></li> 520 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/DataInteraction.html">DataInteraction</a></li> 521 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/Espresso.html">Espresso</a></li> 522 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/GraphHolder.html">GraphHolder</a></li> 523 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/IdlingPolicies.html">IdlingPolicies</a></li> 524 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/IdlingPolicy.html">IdlingPolicy</a></li> 525 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/NoMatchingViewException.Builder.html">NoMatchingViewException.Builder</a></li> 526 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/PerformException.Builder.html">PerformException.Builder</a></li> 527 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/Root.html">Root</a></li> 528 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/Root.Builder.html">Root.Builder</a></li> 529 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/ViewInteraction.html">ViewInteraction</a></li> 530 </ul> 531 </li> 532 533 534 <li><h2>Exceptions</h2> 535 <ul> 536 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/AmbiguousViewMatcherException.html">AmbiguousViewMatcherException</a></li> 537 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/AppNotIdleException.html">AppNotIdleException</a></li> 538 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/IdlingResourceTimeoutException.html">IdlingResourceTimeoutException</a></li> 539 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/InjectEventSecurityException.html">InjectEventSecurityException</a></li> 540 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/NoActivityResumedException.html">NoActivityResumedException</a></li> 541 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/NoMatchingRootException.html">NoMatchingRootException</a></li> 542 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/NoMatchingViewException.html">NoMatchingViewException</a></li> 543 <li class="api apilevel-"><a href="../../../../../reference/android/support/test/espresso/PerformException.html">PerformException</a></li> 544 </ul> 545 </li> 546 547 </ul><br/> 548 549 550 </div><!-- end classes --> 551 </div><!-- end nav-panels --> 552 <div id="nav-tree" style="display:none" class="scroll-pane"> 553 <div id="tree-list"></div> 554 </div><!-- end nav-tree --> 555 </div><!-- end swapper --> 556 <div id="nav-swap"> 557 <a class="fullscreen">fullscreen</a> 558 <a href='#' onclick='swapNav();return false;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a> 559 </div> 560 </div> <!-- end devdoc-nav --> 561 </div> <!-- end side-nav --> 562 <script type="text/javascript"> 563 // init fullscreen based on user pref 564 var fullscreen = readCookie("fullscreen"); 565 if (fullscreen != 0) { 566 if (fullscreen == "false") { 567 toggleFullscreen(false); 568 } else { 569 toggleFullscreen(true); 570 } 571 } 572 // init nav version for mobile 573 if (isMobile) { 574 swapNav(); // tree view should be used on mobile 575 $('#nav-swap').hide(); 576 } else { 577 chooseDefaultNav(); 578 if ($("#nav-tree").is(':visible')) { 579 init_default_navtree("../../../../../"); 580 } 581 } 582 // scroll the selected page into view 583 $(document).ready(function() { 584 scrollIntoView("packages-nav"); 585 scrollIntoView("classes-nav"); 586 }); 587 </script> 588 589 590 591 592 593<div class="col-12" id="doc-col"> 594 595<div id="api-info-block"> 596 597 598 599 600<div class="sum-details-links"> 601 602</div><!-- end sum-details-links --> 603<div class="api-level"> 604 605 606 607 608</div> 609</div><!-- end api-info-block --> 610 611 612<!-- ======== START OF CLASS DATA ======== --> 613 614<div id="jd-header"> 615 public 616 617 618 619 interface 620<h1 itemprop="name">ViewAssertion</h1> 621 622 623 624 625 626 627 628 629 630 631 632</div><!-- end header --> 633 634<div id="naMessage"></div> 635 636<div id="jd-content" class="api apilevel-"> 637<table class="jd-inheritance-table"> 638 639 640 <tr> 641 642 <td colspan="1" class="jd-inheritance-class-cell">android.support.test.espresso.ViewAssertion</td> 643 </tr> 644 645 646</table> 647 648 649 650 651 652 653 654<div class="jd-descr"> 655 656 657<h2>Class Overview</h2> 658<p itemprop="articleBody">Responsible for performing assertions on a View element.<br> 659 <p> 660 This is considered part of the test framework public API - developers are free to write their own 661 assertions as long as they meet the following requirements: 662 <ul> 663 <li>Do not mutate the passed in view. 664 <li>Throw junit.framework.AssertionError when the view assertion does not hold. 665 <li>Implementation runs on the UI thread - so it should not do any blocking operations 666 <li>Downcasting the view to a specific type is allowed, provided there is a test that view is an 667 instance of that type before downcasting. If not, an AssertionError should be thrown. 668 <li>It is encouraged to access non-mutating methods on the view to perform assertion. 669 </ul> 670 <br> 671 <p> 672 Strongly consider using a existing ViewAssertion via the ViewAssertions utility class before 673 writing your own assertion. 674</p> 675 676 677 678 679 680</div><!-- jd-descr --> 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697<div class="jd-descr"> 698 699 700<h2>Summary</h2> 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728<!-- ========== METHOD SUMMARY =========== --> 729<table id="pubmethods" class="jd-sumtable"><tr><th colspan="12">Public Methods</th></tr> 730 731 732 733 734 <tr class="alt-color api apilevel-" > 735 <td class="jd-typecol"><nobr> 736 abstract 737 738 739 740 741 void</nobr> 742 </td> 743 <td class="jd-linkcol" width="100%"><nobr> 744 <span class="sympad"><a href="../../../../../reference/android/support/test/espresso/ViewAssertion.html#check(android.view.View, android.support.test.espresso.NoMatchingViewException)">check</a></span>(View view, <a href="../../../../../reference/android/support/test/espresso/NoMatchingViewException.html">NoMatchingViewException</a> noViewFoundException)</nobr> 745 746 <div class="jd-descrdiv"> 747 Checks the state of the given view (if such a view is present). 748 749 750 751 </div> 752 753 </td></tr> 754 755 756 757</table> 758 759 760 761 762 763 764 765</div><!-- jd-descr (summary) --> 766 767<!-- Details --> 768 769 770 771 772 773 774 775 776<!-- XML Attributes --> 777 778 779<!-- Enum Values --> 780 781 782<!-- Constants --> 783 784 785<!-- Fields --> 786 787 788<!-- Public ctors --> 789 790 791 792<!-- ========= CONSTRUCTOR DETAIL ======== --> 793<!-- Protected ctors --> 794 795 796 797<!-- ========= METHOD DETAIL ======== --> 798<!-- Public methdos --> 799 800<h2>Public Methods</h2> 801 802 803 804<A NAME="check(android.view.View, android.support.test.espresso.NoMatchingViewException)"></A> 805 806<div class="jd-details api apilevel-"> 807 <h4 class="jd-details-title"> 808 <span class="normal"> 809 public 810 811 812 abstract 813 814 void 815 </span> 816 <span class="sympad">check</span> 817 <span class="normal">(View view, <a href="../../../../../reference/android/support/test/espresso/NoMatchingViewException.html">NoMatchingViewException</a> noViewFoundException)</span> 818 </h4> 819 <div class="api-level"> 820 <div></div> 821 822 823 824 </div> 825 <div class="jd-details-descr"> 826 827 828 829 830 <div class="jd-tagdata jd-tagdescr"><p>Checks the state of the given view (if such a view is present).</p></div> 831 <div class="jd-tagdata"> 832 <h5 class="jd-tagtitle">Parameters</h5> 833 <table class="jd-tagtable"> 834 <tr> 835 <th>view</td> 836 <td>the view, if one was found during the view interaction or null if it was not 837 (which may be an acceptable option for an assertion)</td> 838 </tr> 839 <tr> 840 <th>noViewFoundException</td> 841 <td>an exception detailing why the view could not be found or null if 842 the view was found 843</td> 844 </tr> 845 </table> 846 </div> 847 848 </div> 849</div> 850 851 852 853 854 855<!-- ========= METHOD DETAIL ======== --> 856 857 858 859<!-- ========= END OF CLASS DATA ========= --> 860<A NAME="navbar_top"></A> 861</div> <!-- jd-content --> 862 863<div class="wrap"> 864 <div class="dac-footer"> 865 <div class="cols dac-footer-main"> 866 <div class="col-1of2"> 867 <a class="dac-footer-getnews" data-modal-toggle="newsletter" href="javascript:;">Get news & tips <span 868 class="dac-fab dac-primary"><i class="dac-sprite dac-mail"></i></span></a> 869 </div> 870 <div class="col-1of2 dac-footer-reachout"> 871 <div class="dac-footer-contact"> 872 <a class="dac-footer-contact-link" href="http://android-developers.blogspot.com/">Blog</a> 873 <a class="dac-footer-contact-link" href="/support.html">Support</a> 874 </div> 875 <div class="dac-footer-social"> 876 <a class="dac-fab dac-footer-social-link" href="https://www.youtube.com/user/androiddevelopers"><i class="dac-sprite dac-youtube"></i></a> 877 <a class="dac-fab dac-footer-social-link" href="https://plus.google.com/+AndroidDevelopers"><i class="dac-sprite dac-gplus"></i></a> 878 <a class="dac-fab dac-footer-social-link" href="https://twitter.com/AndroidDev"><i class="dac-sprite dac-twitter"></i></a> 879 </div> 880 </div> 881 </div> 882 883 <hr class="dac-footer-separator"/> 884 885 886 <p class="dac-footer-copyright"> 887 888 Except as noted, this content is licensed under <a 889 href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>. 890 For details and restrictions, see the <a href="../../../../../license.html"> 891 Content License</a>. 892 </p> 893 <p class="dac-footer-build"> 894 895 Android r — 896<script src="../../../../../timestamp.js" type="text/javascript"></script> 897<script>document.write(BUILD_TIMESTAMP)</script> 898 899 </p> 900 901 902 <p class="dac-footer-links"> 903 <a href="/about/index.html">About Android</a> 904 <a href="/auto/index.html">Auto</a> 905 <a href="/tv/index.html">TV</a> 906 <a href="/wear/index.html">Wear</a> 907 <a href="/legal.html">Legal</a> 908 909 <span id="language" class="locales"> 910 <select name="language" onchange="changeLangPref(this.value, true)"> 911 <option value="en" selected="selected">English</option> 912 <option value="es">Español</option> 913 <option value="ja">日本語</option> 914 <option value="ko">한국어</option> 915 <option value="ru">Русский</option> 916 <option value="zh-cn">中文(简体)</option> 917 <option value="zh-tw">中文(繁體)</option> 918 </select> 919 </span> 920 </p> 921 </div> 922</div> <!-- end footer --> 923 924<div data-modal="newsletter" data-newsletter data-swap class="dac-modal newsletter"> 925 <div class="dac-modal-container"> 926 <div class="dac-modal-window"> 927 <header class="dac-modal-header"> 928 <button class="dac-modal-header-close" data-modal-toggle><i class="dac-sprite dac-close"></i></button> 929 <div class="dac-swap" data-swap-container> 930 <section class="dac-swap-section dac-active dac-down"> 931 <h2 class="norule dac-modal-header-title">Get the latest Android developer news and tips that will help you find success on Google Play.</h2> 932 <p class="dac-modal-header-subtitle">* Required Fields</p> 933 </section> 934 <section class="dac-swap-section dac-up"> 935 <h2 class="norule dac-modal-header-title">Hooray!</h2> 936 </section> 937 </div> 938 </header> 939 <div class="dac-swap" data-swap-container> 940 <section class="dac-swap-section dac-active dac-left"> 941 <form action="https://docs.google.com/forms/d/1QgnkzbEJIDu9lMEea0mxqWrXUJu0oBCLD7ar23V0Yys/formResponse" class="dac-form" method="post" target="dac-newsletter-iframe"> 942 <section class="dac-modal-content"> 943 <fieldset class="dac-form-fieldset"> 944 <div class="cols"> 945 <div class="col-1of2 newsletter-leftCol"> 946 <div class="dac-form-input-group"> 947 <label for="newsletter-full-name" class="dac-form-floatlabel">Full name</label> 948 <input type="text" class="dac-form-input" name="entry.1357890476" id="newsletter-full-name" required> 949 <span class="dac-form-required">*</span> 950 </div> 951 <div class="dac-form-input-group"> 952 <label for="newsletter-email" class="dac-form-floatlabel">Email address</label> 953 <input type="email" class="dac-form-input" name="entry.472100832" id="newsletter-email" required> 954 <span class="dac-form-required">*</span> 955 </div> 956 </div> 957 <div class="col-1of2 newsletter-rightCol"> 958 <div class="dac-form-input-group"> 959 <label for="newsletter-company" class="dac-form-floatlabel">Company / developer name</label> 960 <input type="text" class="dac-form-input" name="entry.1664780309" id="newsletter-company"> 961 </div> 962 <div class="dac-form-input-group"> 963 <label for="newsletter-play-store" class="dac-form-floatlabel">One of your Play Store app URLs</label> 964 <input type="url" class="dac-form-input" name="entry.47013838" id="newsletter-play-store" required> 965 <span class="dac-form-required">*</span> 966 </div> 967 </div> 968 </div> 969 </fieldset> 970 <fieldset class="dac-form-fieldset"> 971 <div class="cols"> 972 <div class="col-1of2 newsletter-leftCol"> 973 <legend class="dac-form-legend">Which best describes your business:<span class="dac-form-required">*</span> 974 </legend> 975 <div class="dac-form-radio-group"> 976 <input type="radio" value="Apps" class="dac-form-radio" name="entry.1796324055" id="newsletter-business-type-app" required> 977 <label for="newsletter-business-type-app" class="dac-form-radio-button"></label> 978 <label for="newsletter-business-type-app" class="dac-form-label">Apps</label> 979 </div> 980 <div class="dac-form-radio-group"> 981 <input type="radio" value="Games" class="dac-form-radio" name="entry.1796324055" id="newsletter-business-type-games" required> 982 <label for="newsletter-business-type-games" class="dac-form-radio-button"></label> 983 <label for="newsletter-business-type-games" class="dac-form-label">Games</label> 984 </div> 985 <div class="dac-form-radio-group"> 986 <input type="radio" value="Apps and Games" class="dac-form-radio" name="entry.1796324055" id="newsletter-business-type-appsgames" required> 987 <label for="newsletter-business-type-appsgames" class="dac-form-radio-button"></label> 988 <label for="newsletter-business-type-appsgames" class="dac-form-label">Apps & Games</label> 989 </div> 990 </div> 991 <div class="col-1of2 newsletter-rightCol newsletter-checkboxes"> 992 <div class="dac-form-radio-group"> 993 <div class="dac-media"> 994 <div class="dac-media-figure"> 995 <input type="checkbox" class="dac-form-checkbox" name="entry.732309842" id="newsletter-add" required value="Add me to the mailing list for the monthly newsletter and occasional emails about development and Google Play opportunities."> 996 <label for="newsletter-add" class="dac-form-checkbox-button"></label> 997 </div> 998 <div class="dac-media-body"> 999 <label for="newsletter-add" class="dac-form-label dac-form-aside">Add me to the mailing list for the monthly newsletter and occasional emails about development and Google Play opportunities.<span class="dac-form-required">*</span></label> 1000 </div> 1001 </div> 1002 </div> 1003 <div class="dac-form-radio-group"> 1004 <div class="dac-media"> 1005 <div class="dac-media-figure"> 1006 <input type="checkbox" class="dac-form-checkbox" name="entry.2045036090" id="newsletter-terms" required value="I acknowledge that the information provided in this form will be subject to Google's privacy policy (https://www.google.com/policies/privacy/)."> 1007 <label for="newsletter-terms" class="dac-form-checkbox-button"></label> 1008 </div> 1009 <div class="dac-media-body"> 1010 <label for="newsletter-terms" class="dac-form-label dac-form-aside">I acknowledge that the information provided in this form will be subject to <a href="https://www.google.com/policies/privacy/">Google's privacy policy</a>.<span class="dac-form-required">*</span></label> 1011 </div> 1012 </div> 1013 </div> 1014 </div> 1015 </div> 1016 </fieldset> 1017 </section> 1018 <footer class="dac-modal-footer"> 1019 <div class="cols"> 1020 <div class="col-2of5"> 1021 </div> 1022 </div> 1023 <button type="submit" value="Submit" class="dac-fab dac-primary dac-large dac-modal-action"><i class="dac-sprite dac-arrow-right"></i></button> 1024 </footer> 1025 </form> 1026 </section> 1027 <section class="dac-swap-section dac-right"> 1028 <div class="dac-modal-content"> 1029 <p class="newsletter-success-message"> 1030 You have successfully signed up for the latest Android developer news and tips. 1031 </p> 1032 </div> 1033 </section> 1034 </div> 1035 </div> 1036 </div> 1037</div> <!-- end footer --> 1038 1039</div><!-- end doc-content --> 1040 1041</div> <!-- end .cols --> 1042</div> <!-- end body-content --> 1043 1044 1045 1046 1047 1048 1049</body> 1050</html> 1051