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