blob: 9b241d99e26161b9bb495439a2156ca26f94a900 [file] [log] [blame]
Quddus Chong489218c2015-02-26 16:38:46 -08001<!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
97
Quddus Chong900831f2015-04-17 15:01:16 -070098
Quddus Chong489218c2015-02-26 16:38:46 -080099<html>
100<head>
101
102
103<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
104<meta name="viewport" content="width=device-width" />
105
106<link rel="shortcut icon" type="image/x-icon" href="../../../../../../favicon.ico" />
107<title>ActivityLifecycleMonitor | Android Developers</title>
108
109<!-- STYLESHEETS -->
110<link rel="stylesheet"
111href="http://fonts.googleapis.com/css?family=Roboto+Condensed">
112<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold"
113 title="roboto">
Quddus Chong900831f2015-04-17 15:01:16 -0700114<link href="../../../../../../assets/css/default.css?v=5" rel="stylesheet" type="text/css">
Quddus Chong489218c2015-02-26 16:38:46 -0800115
116
117<!-- FULLSCREEN STYLESHEET -->
118<link href="../../../../../../assets/css/fullscreen.css" rel="stylesheet" class="fullscreen"
119type="text/css">
120
121
122<!-- JAVASCRIPT -->
123<script src="http://www.google.com/jsapi" type="text/javascript"></script>
124<script src="../../../../../../assets/js/android_3p-bundle.js" type="text/javascript"></script>
125<script type="text/javascript">
126 var toRoot = "../../../../../../";
127 var metaTags = [];
128 var devsite = false;
129</script>
Quddus Chong900831f2015-04-17 15:01:16 -0700130<script src="../../../../../../assets/js/docs.js?v=3" type="text/javascript"></script>
131
132
Quddus Chong489218c2015-02-26 16:38:46 -0800133
134<script>
135 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
136 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
137 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
138 })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
139
140 ga('create', 'UA-5831155-1', 'android.com');
141 ga('create', 'UA-49880327-2', 'android.com', {'name': 'universal'}); // New tracker);
142 ga('send', 'pageview');
143 ga('universal.send', 'pageview'); // Send page view for new tracker.
144</script>
145
146</head>
147
148<body class="gc-documentation
149 develop reference" itemscope itemtype="http://schema.org/Article">
150 <div id="doc-api-level" class="" style="display:none"></div>
151 <a name="top"></a>
152
153
154<a name="top"></a>
155
Quddus Chong900831f2015-04-17 15:01:16 -0700156<!-- dialog to prompt lang pref change when loaded from hardcoded URL
157<div id="langMessage" style="display:none">
158 <div>
159 <div class="lang en">
160 <p>You requested a page in English, would you like to proceed with this language setting?</p>
161 </div>
162 <div class="lang es">
163 <p>You requested a page in Spanish (Español), would you like to proceed with this language setting?</p>
164 </div>
165 <div class="lang ja">
166 <p>You requested a page in Japanese (日本語), would you like to proceed with this language setting?</p>
167 </div>
168 <div class="lang ko">
169 <p>You requested a page in Korean (한국어), would you like to proceed with this language setting?</p>
170 </div>
171 <div class="lang ru">
172 <p>You requested a page in Russian (Русский), would you like to proceed with this language setting?</p>
173 </div>
174 <div class="lang zh-cn">
175 <p>You requested a page in Simplified Chinese (简体中文), would you like to proceed with this language setting?</p>
176 </div>
177 <div class="lang zh-tw">
178 <p>You requested a page in Traditional Chinese (繁體中文), would you like to proceed with this language setting?</p>
179 </div>
180 <a href="#" class="button yes" onclick="return false;">
181 <span class="lang en">Yes</span>
182 <span class="lang es">Sí</span>
183 <span class="lang ja">Yes</span>
184 <span class="lang ko">Yes</span>
185 <span class="lang ru">Yes</span>
186 <span class="lang zh-cn">是的</span>
187 <span class="lang zh-tw">没有</span>
188 </a>
189 <a href="#" class="button" onclick="$('#langMessage').hide();return false;">
190 <span class="lang en">No</span>
191 <span class="lang es">No</span>
192 <span class="lang ja">No</span>
193 <span class="lang ko">No</span>
194 <span class="lang ru">No</span>
195 <span class="lang zh-cn">没有</span>
196 <span class="lang zh-tw">没有</span>
197 </a>
198 </div>
199</div> -->
200
201
Quddus Chong489218c2015-02-26 16:38:46 -0800202 <!-- Header -->
203 <div id="header-wrapper">
204 <div id="header">
205
206
207
208
209 <div class="wrap" id="header-wrap">
210 <div class="col-3 logo">
211 <a href="../../../../../../index.html">
212 <img src="../../../../../../assets/images/dac_logo.png"
213 srcset="../../../../../../assets/images/dac_logo@2x.png 2x"
214 width="123" height="25" alt="Android Developers" />
215 </a>
216 <div class="btn-quicknav" id="btn-quicknav">
217 <a href="#" class="arrow-inactive">Quicknav</a>
218 <a href="#" class="arrow-active">Quicknav</a>
219 </div>
220 </div>
221 <ul class="nav-x col-9">
222 <li class="design">
223 <a href="../../../../../../design/index.html"
224 zh-tw-lang="設計"
225 zh-cn-lang="设计"
226 ru-lang="Проектирование"
227 ko-lang="디자인"
228 ja-lang="設計"
229 es-lang="Diseñar"
230 >Design</a></li>
231 <li class="develop"><a href="../../../../../../develop/index.html"
232 zh-tw-lang="開發"
233 zh-cn-lang="开发"
234 ru-lang="Разработка"
235 ko-lang="개발"
236 ja-lang="開発"
237 es-lang="Desarrollar"
238 >Develop</a></li>
239 <li class="distribute last"><a href="../../../../../../distribute/index.html"
240 zh-tw-lang="發佈"
241 zh-cn-lang="分发"
242 ru-lang="Распространение"
243 ko-lang="배포"
244 ja-lang="配布"
245 es-lang="Distribuir"
246 >Distribute</a></li>
247 </ul>
248
249
250
251
252<div class="menu-container">
253 <div class="moremenu">
254 <div id="more-btn"></div>
255 </div>
256 <div class="morehover" id="moremenu">
257 <div class="top"></div>
258 <div class="mid">
259 <div class="header">Links</div>
260 <ul>
261 <li><a href="https://play.google.com/apps/publish/" target="_googleplay">Google Play Developer Console</a></li>
262 <li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
263 <li><a href="../../../../../../about/index.html">About Android</a></li>
264 </ul>
265 <div class="header">Android Sites</div>
266 <ul>
267 <li><a href="http://www.android.com">Android.com</a></li>
268 <li class="active"><a>Android Developers</a></li>
269 <li><a href="http://source.android.com">Android Open Source Project</a></li>
270 </ul>
271
272
273
274
275 <br class="clearfix" />
276 </div><!-- end 'mid' -->
277 <div class="bottom"></div>
278 </div><!-- end 'moremenu' -->
279
280 <div class="search" id="search-container">
281 <div class="search-inner">
282 <div id="search-btn"></div>
283 <div class="left"></div>
284 <form onsubmit="return submit_search()">
285 <input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
286 onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
287 onkeydown="return search_changed(event, true, '../../../../../../')"
288 onkeyup="return search_changed(event, false, '../../../../../../')" />
289 </form>
290 <div class="right"></div>
291 <a class="close hide">close</a>
292 <div class="left"></div>
293 <div class="right"></div>
294 </div><!-- end search-inner -->
295 </div><!-- end search-container -->
296
297 <div class="search_filtered_wrapper reference">
298 <div class="suggest-card reference no-display">
299 <ul class="search_filtered">
300 </ul>
301 </div>
302 </div>
303
304 <div class="search_filtered_wrapper docs">
305 <div class="suggest-card dummy no-display">&nbsp;</div>
306 <div class="suggest-card develop no-display">
307 <ul class="search_filtered">
308 </ul>
309 <div class="child-card guides no-display">
310 </div>
311 <div class="child-card training no-display">
312 </div>
313 <div class="child-card samples no-display">
314 </div>
315 </div>
316 <div class="suggest-card design no-display">
317 <ul class="search_filtered">
318 </ul>
319 </div>
320 <div class="suggest-card distribute no-display">
321 <ul class="search_filtered">
322 </ul>
323 </div>
324 </div>
325</div><!-- end menu-container (search and menu widget) -->
326
327
328
329 <!-- Expanded quicknav -->
330 <div id="quicknav" class="col-13">
331 <ul>
332 <li class="about">
333 <ul>
334 <li><a href="../../../../../../about/index.html">About</a></li>
335 <li><a href="../../../../../../wear/index.html">Wear</a></li>
336 <li><a href="../../../../../../tv/index.html">TV</a></li>
337 <li><a href="../../../../../../auto/index.html">Auto</a></li>
338 </ul>
339 </li>
340 <li class="design">
341 <ul>
342 <li><a href="../../../../../../design/index.html">Get Started</a></li>
343 <li><a href="../../../../../../design/devices.html">Devices</a></li>
344 <li><a href="../../../../../../design/style/index.html">Style</a></li>
345 <li><a href="../../../../../../design/patterns/index.html">Patterns</a></li>
346 <li><a href="../../../../../../design/building-blocks/index.html">Building Blocks</a></li>
347 <li><a href="../../../../../../design/downloads/index.html">Downloads</a></li>
348 <li><a href="../../../../../../design/videos/index.html">Videos</a></li>
349 </ul>
350 </li>
351 <li class="develop">
352 <ul>
353 <li><a href="../../../../../../training/index.html"
354 zh-tw-lang="訓練課程"
355 zh-cn-lang="培训"
356 ru-lang="Курсы"
357 ko-lang="교육"
358 ja-lang="トレーニング"
359 es-lang="Capacitación"
360 >Training</a></li>
361 <li><a href="../../../../../../guide/index.html"
362 zh-tw-lang="API 指南"
363 zh-cn-lang="API 指南"
364 ru-lang="Руководства по API"
365 ko-lang="API 가이드"
366 ja-lang="API ガイド"
367 es-lang="Guías de la API"
368 >API Guides</a></li>
369 <li><a href="../../../../../../reference/packages.html"
370 zh-tw-lang="參考資源"
371 zh-cn-lang="参考"
372 ru-lang="Справочник"
373 ko-lang="참조문서"
374 ja-lang="リファレンス"
375 es-lang="Referencia"
376 >Reference</a></li>
377 <li><a href="../../../../../../sdk/index.html"
378 zh-tw-lang="相關工具"
379 zh-cn-lang="工具"
380 ru-lang="Инструменты"
381 ko-lang="도구"
382 ja-lang="ツール"
383 es-lang="Herramientas"
384 >Tools</a>
385 </li>
386 <li><a href="../../../../../../google/index.html">Google Services</a>
387 </li>
388
389 </ul>
390 </li>
391 <li class="distribute last">
392 <ul>
393 <li><a href="../../../../../../distribute/googleplay/index.html">Google Play</a></li>
394 <li><a href="../../../../../../distribute/essentials/index.html">Essentials</a></li>
395 <li><a href="../../../../../../distribute/users/index.html">Get Users</a></li>
396 <li><a href="../../../../../../distribute/engage/index.html">Engage &amp; Retain</a></li>
397 <li><a href="../../../../../../distribute/monetize/index.html">Monetize</a></li>
Quddus Chong900831f2015-04-17 15:01:16 -0700398 <li><a href="../../../../../../distribute/analyze/index.html">Analyze</a></li>
Quddus Chong489218c2015-02-26 16:38:46 -0800399 <li><a href="../../../../../../distribute/tools/index.html">Tools &amp; Reference</a></li>
400 <li><a href="../../../../../../distribute/stories/index.html">Developer Stories</a></li>
401 </ul>
402 </li>
403 </ul>
404 </div><!-- /Expanded quicknav -->
405 </div><!-- end header-wrap.wrap -->
406 </div><!-- end header -->
407
408
409 <!-- Secondary x-nav -->
410 <div id="nav-x">
411 <div class="wrap" style="position:relative;z-index:1">
412
413
Quddus Chong489218c2015-02-26 16:38:46 -0800414
Quddus Chong489218c2015-02-26 16:38:46 -0800415
416
417 <ul class="nav-x col-9 develop" style="width:100%">
418 <li class="training"><a href="../../../../../../training/index.html"
419 zh-tw-lang="訓練課程"
420 zh-cn-lang="培训"
421 ru-lang="Курсы"
422 ko-lang="교육"
423 ja-lang="トレーニング"
424 es-lang="Capacitación"
425 >Training</a></li>
426 <li class="guide"><a href="../../../../../../guide/index.html"
427 zh-tw-lang="API 指南"
428 zh-cn-lang="API 指南"
429 ru-lang="Руководства по API"
430 ko-lang="API 가이드"
431 ja-lang="API ガイド"
432 es-lang="Guías de la API"
433 >API Guides</a></li>
434 <li class="reference"><a href="../../../../../../reference/packages.html"
435 zh-tw-lang="參考資源"
436 zh-cn-lang="参考"
437 ru-lang="Справочник"
438 ko-lang="참조문서"
439 ja-lang="リファレンス"
440 es-lang="Referencia"
441 >Reference</a></li>
442 <li class="tools"><a href="../../../../../../sdk/index.html"
443 zh-tw-lang="相關工具"
444 zh-cn-lang="工具"
445 ru-lang="Инструменты"
446 ko-lang="도구"
447 ja-lang="ツール"
448 es-lang="Herramientas"
449 >Tools</a></li>
450 <li class="google"><a href="../../../../../../google/index.html"
451 >Google Services</a>
452 </li>
453
454 </ul>
455 </div>
456 </div>
457 <!-- /Sendondary x-nav DEVELOP -->
458
459
460
461 <div id="searchResults" class="wrap" style="display:none;">
462 <h2 id="searchTitle">Results</h2>
463 <div id="leftSearchControl" class="search-control">Loading...</div>
464 </div>
465 </div> <!--end header-wrapper -->
466
467 <div id="sticky-header">
468 <div>
469 <a class="logo" href="#top"></a>
470 <a class="top" href="#top"></a>
471 <ul class="breadcrumb">
472
473 <li class="current">ActivityLifecycleMonitor</li>
474 </ul>
475 </div>
476 </div>
477
478
479
480
481
482 <div class="wrap clearfix" id="body-content">
483 <div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
484 <div id="devdoc-nav">
485 <div id="api-nav-header">
486 <div id="api-level-toggle">
487 <label for="apiLevelCheckbox" class="disabled"
488 title="Select your target API level to dim unavailable APIs">API level: </label>
489 <div class="select-wrapper">
490 <select id="apiLevelSelector">
491 <!-- option elements added by buildApiLevelSelector() -->
492 </select>
493 </div>
494 </div><!-- end toggle -->
495 <div id="api-nav-title">Android APIs</div>
496 </div><!-- end nav header -->
497 <script>
498 var SINCE_DATA = [ ];
499 buildApiLevelSelector();
500 </script>
501
502 <div id="swapper">
503 <div id="nav-panels">
504 <div id="resize-packages-nav">
505 <div id="packages-nav" class="scroll-pane">
506
507 <ul>
508
509 <li class="api apilevel-">
510 <a href="../../../../../../reference/android/support/test/package-summary.html">android.support.test</a></li>
511 <li class="api apilevel-">
Quddus Chong900831f2015-04-17 15:01:16 -0700512 <a href="../../../../../../reference/android/support/test/annotation/package-summary.html">android.support.test.annotation</a></li>
513 <li class="api apilevel-">
Quddus Chong489218c2015-02-26 16:38:46 -0800514 <a href="../../../../../../reference/android/support/test/espresso/package-summary.html">android.support.test.espresso</a></li>
515 <li class="api apilevel-">
516 <a href="../../../../../../reference/android/support/test/espresso/action/package-summary.html">android.support.test.espresso.action</a></li>
517 <li class="api apilevel-">
518 <a href="../../../../../../reference/android/support/test/espresso/assertion/package-summary.html">android.support.test.espresso.assertion</a></li>
519 <li class="api apilevel-">
520 <a href="../../../../../../reference/android/support/test/espresso/base/package-summary.html">android.support.test.espresso.base</a></li>
521 <li class="api apilevel-">
522 <a href="../../../../../../reference/android/support/test/espresso/contrib/package-summary.html">android.support.test.espresso.contrib</a></li>
523 <li class="api apilevel-">
Quddus Chong900831f2015-04-17 15:01:16 -0700524 <a href="../../../../../../reference/android/support/test/espresso/intent/package-summary.html">android.support.test.espresso.intent</a></li>
525 <li class="api apilevel-">
526 <a href="../../../../../../reference/android/support/test/espresso/intent/matcher/package-summary.html">android.support.test.espresso.intent.matcher</a></li>
527 <li class="api apilevel-">
528 <a href="../../../../../../reference/android/support/test/espresso/intent/rule/package-summary.html">android.support.test.espresso.intent.rule</a></li>
529 <li class="api apilevel-">
Quddus Chong489218c2015-02-26 16:38:46 -0800530 <a href="../../../../../../reference/android/support/test/espresso/matcher/package-summary.html">android.support.test.espresso.matcher</a></li>
531 <li class="api apilevel-">
532 <a href="../../../../../../reference/android/support/test/espresso/util/package-summary.html">android.support.test.espresso.util</a></li>
533 <li class="api apilevel-">
534 <a href="../../../../../../reference/android/support/test/filters/package-summary.html">android.support.test.filters</a></li>
535 <li class="api apilevel-">
Quddus Chong900831f2015-04-17 15:01:16 -0700536 <a href="../../../../../../reference/android/support/test/rule/package-summary.html">android.support.test.rule</a></li>
537 <li class="api apilevel-">
Quddus Chong489218c2015-02-26 16:38:46 -0800538 <a href="../../../../../../reference/android/support/test/runner/package-summary.html">android.support.test.runner</a></li>
Quddus Chong900831f2015-04-17 15:01:16 -0700539 <li class="api apilevel-">
540 <a href="../../../../../../reference/android/support/test/runner/intent/package-summary.html">android.support.test.runner.intent</a></li>
Quddus Chong489218c2015-02-26 16:38:46 -0800541 <li class="selected api apilevel-">
542 <a href="../../../../../../reference/android/support/test/runner/lifecycle/package-summary.html">android.support.test.runner.lifecycle</a></li>
543 <li class="api apilevel-">
544 <a href="../../../../../../reference/android/support/test/uiautomator/package-summary.html">android.support.test.uiautomator</a></li>
545 </ul><br/>
546
547 </div> <!-- end packages-nav -->
548 </div> <!-- end resize-packages -->
549 <div id="classes-nav" class="scroll-pane">
550
551
552
553 <ul>
554
555
556 <li><h2>Interfaces</h2>
557 <ul>
558 <li class="api apilevel-"><a href="../../../../../../reference/android/support/test/runner/lifecycle/ActivityLifecycleCallback.html">ActivityLifecycleCallback</a></li>
559 <li class="selected api apilevel-"><a href="../../../../../../reference/android/support/test/runner/lifecycle/ActivityLifecycleMonitor.html">ActivityLifecycleMonitor</a></li>
Quddus Chong900831f2015-04-17 15:01:16 -0700560 <li class="api apilevel-"><a href="../../../../../../reference/android/support/test/runner/lifecycle/ApplicationLifecycleCallback.html">ApplicationLifecycleCallback</a></li>
561 <li class="api apilevel-"><a href="../../../../../../reference/android/support/test/runner/lifecycle/ApplicationLifecycleMonitor.html">ApplicationLifecycleMonitor</a></li>
Quddus Chong489218c2015-02-26 16:38:46 -0800562 </ul>
563 </li>
564
Quddus Chong900831f2015-04-17 15:01:16 -0700565 <li><h2>Classes</h2>
566 <ul>
567 <li class="api apilevel-"><a href="../../../../../../reference/android/support/test/runner/lifecycle/ActivityLifecycleMonitorRegistry.html">ActivityLifecycleMonitorRegistry</a></li>
568 <li class="api apilevel-"><a href="../../../../../../reference/android/support/test/runner/lifecycle/ApplicationLifecycleMonitorRegistry.html">ApplicationLifecycleMonitorRegistry</a></li>
569 </ul>
570 </li>
Quddus Chong489218c2015-02-26 16:38:46 -0800571
572 <li><h2>Enums</h2>
573 <ul>
Quddus Chong900831f2015-04-17 15:01:16 -0700574 <li class="api apilevel-"><a href="../../../../../../reference/android/support/test/runner/lifecycle/ApplicationStage.html">ApplicationStage</a></li>
Quddus Chong489218c2015-02-26 16:38:46 -0800575 <li class="api apilevel-"><a href="../../../../../../reference/android/support/test/runner/lifecycle/Stage.html">Stage</a></li>
576 </ul>
577 </li>
578
579
580 </ul><br/>
581
582
583 </div><!-- end classes -->
584 </div><!-- end nav-panels -->
585 <div id="nav-tree" style="display:none" class="scroll-pane">
586 <div id="tree-list"></div>
587 </div><!-- end nav-tree -->
588 </div><!-- end swapper -->
589 <div id="nav-swap">
590 <a class="fullscreen">fullscreen</a>
591 <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>
592 </div>
593 </div> <!-- end devdoc-nav -->
594 </div> <!-- end side-nav -->
595 <script type="text/javascript">
596 // init fullscreen based on user pref
597 var fullscreen = readCookie("fullscreen");
598 if (fullscreen != 0) {
599 if (fullscreen == "false") {
600 toggleFullscreen(false);
601 } else {
602 toggleFullscreen(true);
603 }
604 }
605 // init nav version for mobile
606 if (isMobile) {
607 swapNav(); // tree view should be used on mobile
608 $('#nav-swap').hide();
609 } else {
610 chooseDefaultNav();
611 if ($("#nav-tree").is(':visible')) {
612 init_default_navtree("../../../../../../");
613 }
614 }
615 // scroll the selected page into view
616 $(document).ready(function() {
617 scrollIntoView("packages-nav");
618 scrollIntoView("classes-nav");
619 });
620 </script>
621
622
623
624
625
626<div class="col-12" id="doc-col">
627
628<div id="api-info-block">
629
630
631
632
633<div class="sum-details-links">
634
635</div><!-- end sum-details-links -->
636<div class="api-level">
637
638
639
640
641</div>
642</div><!-- end api-info-block -->
643
644
645<!-- ======== START OF CLASS DATA ======== -->
646
647<div id="jd-header">
648 public
649
650
651
652 interface
653<h1 itemprop="name">ActivityLifecycleMonitor</h1>
654
655
656
657
658
659
660
661
662
663
664
665</div><!-- end header -->
666
667<div id="naMessage"></div>
668
669<div id="jd-content" class="api apilevel-">
670<table class="jd-inheritance-table">
671
672
673 <tr>
674
675 <td colspan="1" class="jd-inheritance-class-cell">android.support.test.runner.lifecycle.ActivityLifecycleMonitor</td>
676 </tr>
677
678
679</table>
680
681
682
683
684
685
686
687<div class="jd-descr">
688
689
690<h2>Class Overview</h2>
691<p itemprop="articleBody">Interface for tests to use when they need to query the activity lifecycle state.
692 <p>
693 Activity lifecycle changes occur only on the UI thread - therefore listeners registered with
694 an ActivityLifecycleMonitor should expect to be invoked on the UI thread. The direct query
695 methods can only be called on the UI thread because otherwise they would not be able to return
696 consistent responses.
697 </p>
698 <p>
699 Retrieve instances of the monitor thru ActivityLifecycleMonitorRegistry.
700 </p>
701 <p>
702 Detecting these lifecycle states requires support from Instrumentation, therefore do not expect
703 an instance to be present under any arbitrary instrumentation.
704 </p>
705</p>
706
707
708
709
710
711</div><!-- jd-descr -->
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728<div class="jd-descr">
729
730
731<h2>Summary</h2>
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759<!-- ========== METHOD SUMMARY =========== -->
760<table id="pubmethods" class="jd-sumtable"><tr><th colspan="12">Public Methods</th></tr>
761
762
763
764
765 <tr class="alt-color api apilevel-" >
766 <td class="jd-typecol"><nobr>
767 abstract
768
769
770
771
772 void</nobr>
773 </td>
774 <td class="jd-linkcol" width="100%"><nobr>
775 <span class="sympad"><a href="../../../../../../reference/android/support/test/runner/lifecycle/ActivityLifecycleMonitor.html#addLifecycleCallback(android.support.test.runner.lifecycle.ActivityLifecycleCallback)">addLifecycleCallback</a></span>(<a href="../../../../../../reference/android/support/test/runner/lifecycle/ActivityLifecycleCallback.html">ActivityLifecycleCallback</a> callback)</nobr>
776
777 <div class="jd-descrdiv">
778 Adds a new callback that will be notified when lifecycle changes occur.
779
780
781
782 </div>
783
784 </td></tr>
785
786
787
788 <tr class=" api apilevel-" >
789 <td class="jd-typecol"><nobr>
790 abstract
791
792
793
794
795 Collection&lt;Activity&gt;</nobr>
796 </td>
797 <td class="jd-linkcol" width="100%"><nobr>
798 <span class="sympad"><a href="../../../../../../reference/android/support/test/runner/lifecycle/ActivityLifecycleMonitor.html#getActivitiesInStage(android.support.test.runner.lifecycle.Stage)">getActivitiesInStage</a></span>(<a href="../../../../../../reference/android/support/test/runner/lifecycle/Stage.html">Stage</a> stage)</nobr>
799
800 <div class="jd-descrdiv">
801 Returns all activities in a given stage of their lifecycle.
802
803
804
805 </div>
806
807 </td></tr>
808
809
810
811 <tr class="alt-color api apilevel-" >
812 <td class="jd-typecol"><nobr>
813 abstract
814
815
816
817
818 <a href="../../../../../../reference/android/support/test/runner/lifecycle/Stage.html">Stage</a></nobr>
819 </td>
820 <td class="jd-linkcol" width="100%"><nobr>
821 <span class="sympad"><a href="../../../../../../reference/android/support/test/runner/lifecycle/ActivityLifecycleMonitor.html#getLifecycleStageOf(android.app.Activity)">getLifecycleStageOf</a></span>(Activity activity)</nobr>
822
823 <div class="jd-descrdiv">
824 Returns the current lifecycle stage of a given activity.
825
826
827
828 </div>
829
830 </td></tr>
831
832
833
834 <tr class=" api apilevel-" >
835 <td class="jd-typecol"><nobr>
836 abstract
837
838
839
840
841 void</nobr>
842 </td>
843 <td class="jd-linkcol" width="100%"><nobr>
844 <span class="sympad"><a href="../../../../../../reference/android/support/test/runner/lifecycle/ActivityLifecycleMonitor.html#removeLifecycleCallback(android.support.test.runner.lifecycle.ActivityLifecycleCallback)">removeLifecycleCallback</a></span>(<a href="../../../../../../reference/android/support/test/runner/lifecycle/ActivityLifecycleCallback.html">ActivityLifecycleCallback</a> callback)</nobr>
845
846 <div class="jd-descrdiv">
847 Removes a previously registered lifecycle callback.
848
849
850
851 </div>
852
853 </td></tr>
854
855
856
857</table>
858
859
860
861
862
863
864
865</div><!-- jd-descr (summary) -->
866
867<!-- Details -->
868
869
870
871
872
873
874
875
876<!-- XML Attributes -->
877
878
879<!-- Enum Values -->
880
881
882<!-- Constants -->
883
884
885<!-- Fields -->
886
887
888<!-- Public ctors -->
889
890
891
892<!-- ========= CONSTRUCTOR DETAIL ======== -->
893<!-- Protected ctors -->
894
895
896
897<!-- ========= METHOD DETAIL ======== -->
898<!-- Public methdos -->
899
900<h2>Public Methods</h2>
901
902
903
904<A NAME="addLifecycleCallback(android.support.test.runner.lifecycle.ActivityLifecycleCallback)"></A>
905
906<div class="jd-details api apilevel-">
907 <h4 class="jd-details-title">
908 <span class="normal">
909 public
910
911
912 abstract
913
914 void
915 </span>
916 <span class="sympad">addLifecycleCallback</span>
917 <span class="normal">(<a href="../../../../../../reference/android/support/test/runner/lifecycle/ActivityLifecycleCallback.html">ActivityLifecycleCallback</a> callback)</span>
918 </h4>
919 <div class="api-level">
920 <div></div>
921
922
923
924 </div>
925 <div class="jd-details-descr">
926
927
928
929
930 <div class="jd-tagdata jd-tagdescr"><p>Adds a new callback that will be notified when lifecycle changes occur.
931 <p>
932 Implementors will not hold a strong ref to the callback, the code which registers callbacks
933 is responsible for this. Code which registers callbacks should responsibly
934 remove their callback when it is no longer needed.
935 </p>
936 <p>
937 Callbacks are executed on the main thread of the application, and should take care not to
938 block or otherwise perform expensive operations as it will directly impact the application.
939 </p></p></div>
940 <div class="jd-tagdata">
941 <h5 class="jd-tagtitle">Parameters</h5>
942 <table class="jd-tagtable">
943 <tr>
944 <th>callback</td>
945 <td>an ActivityLifecycleCallback
946</td>
947 </tr>
948 </table>
949 </div>
950
951 </div>
952</div>
953
954
955<A NAME="getActivitiesInStage(android.support.test.runner.lifecycle.Stage)"></A>
956
957<div class="jd-details api apilevel-">
958 <h4 class="jd-details-title">
959 <span class="normal">
960 public
961
962
963 abstract
964
965 Collection&lt;Activity&gt;
966 </span>
967 <span class="sympad">getActivitiesInStage</span>
968 <span class="normal">(<a href="../../../../../../reference/android/support/test/runner/lifecycle/Stage.html">Stage</a> stage)</span>
969 </h4>
970 <div class="api-level">
971 <div></div>
972
973
974
975 </div>
976 <div class="jd-details-descr">
977
978
979
980
981 <div class="jd-tagdata jd-tagdescr"><p>Returns all activities in a given stage of their lifecycle.
982 <p>
983 This method can only return a consistant and correct answer from the main thread, therefore
984 callers should always invoke it from the main thread and implementors are free to throw an
985 exception if the call is not made on the main thread.
986 </p>
987 <p>
988 Implementors should ensure this method returns a consistant response if called from a
989 lifecycle callback also registered with this monitor (eg: it would be horriblely wrong if a
990 callback sees PAUSED and calls this method with the PAUSED and does not see its activity in
991 the response.
992 </p>
993 <p>
994 Callers should be aware that the monitor implementation may not hold strong references to the
995 Activities in the application. Therefore stages which are considered end stages or eligible
996 for garbage collection on low memory situations may not return an instance of a particular
997 activity if it has been garbage collected.</p></div>
998 <div class="jd-tagdata">
999 <h5 class="jd-tagtitle">Parameters</h5>
1000 <table class="jd-tagtable">
1001 <tr>
1002 <th>stage</td>
1003 <td>the stage to query for.</td>
1004 </tr>
1005 </table>
1006 </div>
1007 <div class="jd-tagdata">
1008 <h5 class="jd-tagtitle">Returns</h5>
1009 <ul class="nolist"><li>a snapshot Collection of activities in the given stage. This collection may be empty.</li></ul>
1010 </div>
1011 <div class="jd-tagdata">
1012 <h5 class="jd-tagtitle">Throws</h5>
1013 <table class="jd-tagtable">
1014 <tr>
1015 <th>IllegalStateException</td>
1016 <td>if called from outside the main thread.
1017</td>
1018 </tr>
1019 </table>
1020 </div>
1021
1022 </div>
1023</div>
1024
1025
1026<A NAME="getLifecycleStageOf(android.app.Activity)"></A>
1027
1028<div class="jd-details api apilevel-">
1029 <h4 class="jd-details-title">
1030 <span class="normal">
1031 public
1032
1033
1034 abstract
1035
1036 <a href="../../../../../../reference/android/support/test/runner/lifecycle/Stage.html">Stage</a>
1037 </span>
1038 <span class="sympad">getLifecycleStageOf</span>
1039 <span class="normal">(Activity activity)</span>
1040 </h4>
1041 <div class="api-level">
1042 <div></div>
1043
1044
1045
1046 </div>
1047 <div class="jd-details-descr">
1048
1049
1050
1051
1052 <div class="jd-tagdata jd-tagdescr"><p>Returns the current lifecycle stage of a given activity.
1053 <p>
1054 This method can only return a consistant and correct answer
1055 from the main thread, therefore callers should always invoke
1056 it from the main thread and implementors are free to throw an
1057 exception if the call is not made on the main thread.
1058 </p>
1059 <p>
1060 Implementors should ensure this method returns a consistant response if called from a
1061 lifecycle callback also registered with this monitor (eg: it would be horriblely wrong if a
1062 callback sees PAUSED and calls this method with the same activity and gets RESUMED.
1063 </p></p></div>
1064 <div class="jd-tagdata">
1065 <h5 class="jd-tagtitle">Parameters</h5>
1066 <table class="jd-tagtable">
1067 <tr>
1068 <th>activity</td>
1069 <td>an activity in this application.</td>
1070 </tr>
1071 </table>
1072 </div>
1073 <div class="jd-tagdata">
1074 <h5 class="jd-tagtitle">Returns</h5>
1075 <ul class="nolist"><li>the lifecycle stage this activity is in.</li></ul>
1076 </div>
1077 <div class="jd-tagdata">
1078 <h5 class="jd-tagtitle">Throws</h5>
1079 <table class="jd-tagtable">
1080 <tr>
1081 <th>IllegalArgumentException</td>
1082 <td>if activity is unknown to the monitor.</td>
1083 </tr>
1084 <tr>
1085 <th>NullPointerException</td>
1086 <td>if activity is null.</td>
1087 </tr>
1088 <tr>
1089 <th>IllegalStateException</td>
1090 <td>if called off the main thread.
1091</td>
1092 </tr>
1093 </table>
1094 </div>
1095
1096 </div>
1097</div>
1098
1099
1100<A NAME="removeLifecycleCallback(android.support.test.runner.lifecycle.ActivityLifecycleCallback)"></A>
1101
1102<div class="jd-details api apilevel-">
1103 <h4 class="jd-details-title">
1104 <span class="normal">
1105 public
1106
1107
1108 abstract
1109
1110 void
1111 </span>
1112 <span class="sympad">removeLifecycleCallback</span>
1113 <span class="normal">(<a href="../../../../../../reference/android/support/test/runner/lifecycle/ActivityLifecycleCallback.html">ActivityLifecycleCallback</a> callback)</span>
1114 </h4>
1115 <div class="api-level">
1116 <div></div>
1117
1118
1119
1120 </div>
1121 <div class="jd-details-descr">
1122
1123
1124
1125
1126 <div class="jd-tagdata jd-tagdescr"><p>Removes a previously registered lifecycle callback.
1127</p></div>
1128
1129 </div>
1130</div>
1131
1132
1133
1134
1135
1136<!-- ========= METHOD DETAIL ======== -->
1137
1138
1139
1140<!-- ========= END OF CLASS DATA ========= -->
1141<A NAME="navbar_top"></A>
1142
1143<div id="footer" class="wrap" >
1144
1145
1146 <div id="copyright">
1147
1148 Except as noted, this content is licensed under <a
1149 href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>.
1150 For details and restrictions, see the <a href="../../../../../../license.html">
1151 Content License</a>.
1152 </div>
1153 <div id="build_info">
1154
1155 Android &nbsp;r &mdash;
1156<script src="../../../../../../timestamp.js" type="text/javascript"></script>
1157<script>document.write(BUILD_TIMESTAMP)</script>
1158
1159 </div>
1160
1161
1162 <div id="footerlinks">
1163
1164 <p>
1165 <a href="../../../../../../about/index.html">About Android</a>&nbsp;&nbsp;|&nbsp;
1166 <a href="../../../../../../legal.html">Legal</a>&nbsp;&nbsp;|&nbsp;
1167 <a href="../../../../../../support.html">Support</a>
1168 </p>
1169 </div>
1170
1171</div> <!-- end footer -->
1172</div> <!-- jd-content -->
1173
1174</div><!-- end doc-content -->
1175
1176</div> <!-- end body-content -->
1177
1178
1179
1180
1181
1182
1183</body>
1184</html>