1 page.title= 2 @jd:body 3 4 <div id="qv-wrapper"> 5 <div id="qv"> 6 <h2></h2> 7 <ol> 8 <li>{@link android.app.Activity}</li> 9 <li>{@link android.app.Service}</li> 10 <li>{@link android.content.BroadcastReceiver}</li> 11 <li>{@link android.content.ContentProvider}</li> 12 <li>{@link android.content.Intent}</li> 13 </ol> 14 15 <h2></h2> 16 <ol> 17 <li><a href="#appcomp"></a> 18 <ol> 19 <li><a href="#actcomp">: </a></li> 20 <li><a href="#endcomp"></a></li> 21 <li><a href="#manfile"> </a></li> 22 <li><a href="#ifilters"> </a></li> 23 </ol></li> 24 <li><a href="#acttask"></a> 25 <ol> 26 <li><a href="#afftask"></a></li> 27 <li><a href="#lmodes"></a></li> 28 <li><a href="#clearstack"></a></li> 29 <li><a href="#starttask"></a></li> 30 </ol></li> 31 <li><a href="#procthread"></a> 32 <ol> 33 <li><a href="#procs"></a></li> 34 <li><a href="#threads"></a></li> 35 <li><a href="#rpc"> </a></li> 36 <li><a href="#tsafe"></a></li> 37 </ol></li> 38 <li><a href="#lcycles"></a> 39 <ol> 40 <li><a href="#actlife"></a></li> 41 <li><a href="#servlife"></a></li> 42 <li><a href="#broadlife"> </a></li> 43 <li><a href="#proclife"></a></li> 44 </ol></li> 45 </ol> 46 </div> 47 </div> 48 49 <p> 50 Android Java Java <a href="{@docRoot}tools/aapt.html"><code>aapt</code> </a> Android Android {@code .apk} <i></i>Android 1 {@code .apk} 1 <i></i> 51 </p> 52 53 <p> 54 Android : 55 </p> 56 57 <ul> 58 <li> Linux Android </li> 59 60 <li> Java VM </li> 61 62 <li> Linux ID </li> 63 </ul> 64 65 <p> 66 2 ID ID VM Linux 67 </p> 68 69 70 <h2 id="appcomp"></h2> 71 72 <p> 73 Android 1 74 </p> 75 76 <p> 77 Java Android {@code main()} <i></i> 4 : 78 </p> 79 80 <dl> 81 82 <dt><b></b></dt> 83 <dd> 1 <i></i> SMS {@link android.app.Activity} 84 85 <p> 86 1 SMS 87 </p> 88 89 <p> 90 91 </p> 92 93 <p> 94 {@link android.view.View} Android 95 </p> 96 97 <p> 98 <code>{@link android.app.Activity#setContentView Activity.setContentView()}</code> View <i></i><a href="{@docRoot}guide/topics/ui/index.html">User Interface</a> 99 </p> 100 101 <p><dt><b></b></dt> 102 <dd> <i></i> BGM {@link android.app.Service} 103 104 <p> 105 1 106 </p> 107 108 <p> 109 110 </p> 111 112 <p> 113 <a href="#procthread"></a> 114 </p></dd> 115 116 <dt><b> </b></dt> 117 <dd> <i></i> 118 119 <p> 120 {@link android.content.BroadcastReceiver} 121 </p> 122 123 <p> 124 {@link android.app.NotificationManager} 125 </p></dd> 126 127 <dt><b> </b></dt> 128 <dd> <i></i> SQLite {@link android.content.ContentProvider} {@link android.content.ContentResolver} ContentResolver 129 130 <p> 131 <a href="{@docRoot}guide/topics/providers/content-providers.html">Content Providers</a> 132 </p></dd> 133 134 </dl> 135 136 <p> 137 Android 138 </p> 139 140 141 <h3 id="actcomp">: </h3> 142 143 <p> 144 ContentResolver 3 <i></i> {@link android.content.Intent} Intent URI Intent 145 </p> 146 147 <p> 148 : 149 </p> 150 151 <ul> 152 153 <li>Intent <code>{@link android.content.Context#startActivity 154 Context.startActivity()}</code> <code>{@link 155 android.app.Activity#startActivityForResult 156 Activity.startActivityForResult()}</code> <code>{@link android.app.Activity#getIntent getIntent()}</code> Android <code>{@link 157 android.app.Activity#onNewIntent onNewIntent()}</code> 158 159 <p> 160 {@code startActivity()} {@code startActivityForResult()} <code>{@link android.app.Activity#onActivityResult 161 onActivityResult()}</code> Intent 162 </p> 163 </li> 164 165 <li><p><code>{@link 166 android.content.Context#startService Context.startService()}</code> Intent Android <code>{@link android.app.Service#onStart 167 onStart()}</code> Intent </p> 168 169 <p> 170 <code>{@link 171 android.content.Context#bindService Context.bindService()}</code> <code>{@link android.app.Service#onBind onBind()}</code> Intent {@code bindService()} {@code bindService()} 172 </p> 173 174 <p> 175 <a href="#rpc"> </a> 176 </p> 177 </li> 178 179 <li><p><code>{@link 180 android.content.Context#sendBroadcast(Intent) Context.sendBroadcast()}</code><code>{@link android.content.Context#sendOrderedBroadcast(Intent, String) 181 Context.sendOrderedBroadcast()}</code><code>{@link 182 android.content.Context#sendStickyBroadcast Context.sendStickyBroadcast()}</code> Intent Android <code>{@link 183 android.content.BroadcastReceiver#onReceive onReceive()}</code> </p></li> 184 185 </ul> 186 187 <p> 188 <a href="{@docRoot}guide/components/intents-filters.html">Intents and Intent Filters</a> 189 </p> 190 191 192 <h3 id="endcomp"></h3> 193 194 <p> 195 ContentResolver 196 </p> 197 198 <p> 199 Android : 200 </p> 201 202 <ul> 203 <li> <code>{@link android.app.Activity#finish finish()}</code> {@code startActivityForResult()} <code>{@link android.app.Activity#finishActivity finishActivity()}</code> </li> 204 205 <li> <code>{@link android.app.Service#stopSelf stopSelf()}</code> <code>{@link android.content.Context#stopService Context.stopService()}</code> </li> 206 </ul> 207 208 <p> 209 Android <a href="#lcycles"></a> 210 </p> 211 212 213 <h3 id="manfile"> </h3> 214 215 <p> 216 Android Android {@code .apk} 217 </p> 218 219 <p> 220 XML AndroidManifest.xml Android 221 </p> 222 223 <p> 224 Android : 225 </p> 226 227 <pre><?xml version="1.0" encoding="utf-8"?> 228 <manifest . . . > 229 <application . . . > 230 <activity android:name="com.example.project.FreneticActivity" 231 android:icon="@drawable/small_pic.png" 232 android:label="@string/freneticLabel" 233 . . . > 234 </activity> 235 . . . 236 </application> 237 </manifest></pre> 238 239 <p> 240 <code><a href="{@docRoot}guide/topics/manifest/activity-element.html"><activity></a></code> {@code name} {@link android.app.Activity} {@code icon} {@code label} 241 </p> 242 243 <p> 244 <code><a href="{@docRoot}guide/topics/manifest/service-element.html"><service></a></code> <code><a href="{@docRoot}guide/topics/manifest/receiver-element.html"><receiver></a></code> <code><a href="{@docRoot}guide/topics/manifest/provider-element.html"><provider></a></code> {@link android.content.BroadcastReceiver} <code>{@link android.content.Context#registerReceiver Context.registerReceiver()}</code> 245 </p> 246 247 <p> 248 <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">The AndroidManifest.xml File</a> 249 </p> 250 251 252 <h3 id="ifilters"> </h3> 253 254 <p> 255 Intent Android Intent <i></i> 1 2 : 256 </p> 257 258 <pre><?xml version="1.0" encoding="utf-8"?> 259 <manifest . . . > 260 <application . . . > 261 <activity android:name="com.example.project.FreneticActivity" 262 android:icon="@drawable/small_pic.png" 263 android:label="@string/freneticLabel" 264 . . . > 265 <intent-filter . . . > 266 <action android:name="android.intent.action.MAIN" /> 267 <category android:name="android.intent.category.LAUNCHER" /> 268 </intent-filter> 269 <intent-filter . . . > 270 <action android:name="com.example.project.BOUNCE" /> 271 <data android:mimeType="image/jpeg" /> 272 <category android:name="android.intent.category.DEFAULT" /> 273 </intent-filter> 274 </activity> 275 . . . 276 </application> 277 </manifest></pre> 278 279 <p> 280 1 {@code android.intent.action.MAIN}{@code android.intent.category.LAUNCHER} 281 </p> 282 283 <p> 284 2 285 </p> 286 287 <p> 288 1 289 </p> 290 291 <p> 292 {@link android.content.IntentFilter} 293 </p> 294 295 <p> 296 <a href="{@docRoot}guide/components/intents-filters.html">Intents and Intent Filters</a> 297 </p> 298 299 300 <h2 id="acttask"></h2> 301 302 <p> 303 Intent {@code startActivity()} [] 304 </p> 305 306 <p> 307 Android <i></i> 1 1 [[]] 1 308 </p> 309 310 <p> 311 Activity 312 </p> 313 314 <p> 315 316 </p> 317 318 <p> 319 1 4 3 [] <i></i> 1 4 [] 1 1 320 </p> 321 322 <p> 323 Intent <code><a href="{@docRoot}guide/topics/manifest/activity-element.html"><activity></a></code> 324 </p> 325 326 <p> 327 Intent : 328 329 <p style="margin-left: 2em">{@code FLAG_ACTIVITY_NEW_TASK} <br/>{@code FLAG_ACTIVITY_CLEAR_TOP} <br/>{@code FLAG_ACTIVITY_RESET_TASK_IF_NEEDED} <br/>{@code FLAG_ACTIVITY_SINGLE_TOP}</p> 330 331 <p> 332 {@code <activity>} : 333 334 <p style="margin-left: 2em">{@code taskAffinity} <br/>{@code launchMode} <br/>{@code allowTaskReparenting} <br/>{@code clearTaskOnLaunch} <br/>{@code alwaysRetainTaskState} <br/>{@code finishOnTaskLaunch}</p> 335 336 <p> 337 338 </p> 339 340 341 <h3 id="afftask"></h3> 342 343 <p> 344 <i></i>{@code <activity>} {@code taskAffinity} 2 1 Intent {@code FLAG_ACTIVITY_NEW_TASK} 1 {@code allowTaskReparenting} "{@code true}" 345 </p> 346 347 <dl> 348 <dt><code>{@link android.content.Intent#FLAG_ACTIVITY_NEW_TASK}</code> </dt> 349 <dd> {@code startActivity()} {@code startActivity()} Intent {@code FLAG_ACTIVITY_NEW_TASK} </dd> 350 351 <dt><code><a 352 href="{@docRoot}guide/topics/manifest/activity-element.html#reparent">allowTaskReparenting</a></code> </dt> 353 <dd>{@code allowTaskReparenting} "{@code true}" </dd> 354 </dl> 355 356 <p> 357 1 {@code .apk} 358 </p> 359 360 361 <h3 id="lmodes"></h3> 362 363 <p> 364 <code><a href="{@docRoot}guide/topics/manifest/activity-element.html#lmode">launchMode</a></code> {@code <activity>} 4 : 365 </p> 366 367 <p style="margin-left: 2em">"{@code standard}" <br>"{@code singleTop}"<br>"{@code singleTask}"<br>"{@code singleInstance}"</p> 368 369 <p> 370 4 : 371 </p> 372 373 <ul> 374 375 <li><b></b>"{@code standard}" "{@code singleTop}" <code>{@link android.content.Context#startActivity startActivity()}</code> Intent <code>{@link android.content.Intent#FLAG_ACTIVITY_NEW_TASK}</code> <a href="#afftask"></a> 376 377 <p> 378 "{@code singleTask}" "{@code singleInstance}" 379 </p> 380 381 <li><p><b></b>"{@code standard}" "{@code singleTop}" 382 </p> 383 384 <p> 385 "{@code singleTask}" "{@code singleInstance}" 1 386 </p> 387 388 <li><p><b></b>"{@code singleInstance}" {@code FLAG_ACTIVITY_NEW_TASK} "{@code singleInstance}" "{@code singleTask}" </p> 389 390 <p> 391 3 "{@code singleTask}" "{@code standard}" "{@code singleTop}" 392 </p></li> 393 394 <li><b></b> "{@code standard}" 1 "{@code singleTop}" 395 396 <p> 397 A BCD A-B-C-D D D D "{@code standard}" A-B-C-D-D D "{@code singleTop}" D A-B-C-D 398 </p> 399 400 <p> 401 B B "{@code standard}" "{@code singleTop}" B B A-B-C-D-B 402 </p> 403 404 <p> 405 "{@code singleTask}" "{@code singleInstance}" "{@code singleInstance}" "{@code singleTask}" 406 </p> 407 </li> 408 409 </ul> 410 411 <p> 412 <code>{@link android.app.Activity#onNewIntent onNewIntent()}</code> Intent <code>{@link android.app.Activity#getIntent getIntent()}</code> 413 </p> 414 415 <p> 416 [[]] 1 1 [[]] 417 </p> 418 419 <p> 420 <code><a href="{@docRoot}guide/topics/manifest/activity-element.html"><activity></a></code> 421 </p> 422 423 424 <h3 id="clearstack"></h3> 425 426 <p> 427 428 </p> 429 430 <p> 431 : 432 </p> 433 434 <dl> 435 <dt><code><a 436 href="{@docRoot}guide/topics/manifest/activity-element.html#always">alwaysRetainTaskState</a></code> </dt> 437 <dd> "{@code true}" </dd> 438 439 <dt><code><a 440 href="{@docRoot}guide/topics/manifest/activity-element.html#clear">clearTaskOnLaunch</a></code> </dt> 441 <dd> "{@code true}" {@code alwaysRetainTaskState} </dd> 442 443 <dt><code><a 444 href="{@docRoot}guide/topics/manifest/activity-element.html#finish">finishOnTaskLaunch</a></code> </dt> 445 <dd> {@code clearTaskOnLaunch} "{@code true}" </dd> 446 </dl> 447 448 <p> 449 Intent <code>{@link 450 android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP FLAG_ACTIVITY_CLEAR_TOP}</code> "{@code standard}" "{@code standard}" 451 </p> 452 453 <p> 454 {@code FLAG_ACTIVITY_CLEAR_TOP} {@code FLAG_ACTIVITY_NEW_TASK} 455 </p> 456 457 458 <h3 id="starttask"></h3> 459 460 <p> 461 "{@code android.intent.action.MAIN}" "{@code android.intent.category.LAUNCHER}" <a href="#ifilters"> </a> 462 </p> 463 464 <p> 465 2 {@code MAIN} {@code LAUNCHER} "{@code singleTask}" "{@code singleInstance}" "{@code singleTask}" [] 466 </p> 467 468 <p> 469 {@code FLAG_ACTIVITY_NEW_TASK} [] {@code startActivity()} {@code FLAG_ACTIVITY_NEW_TASK} 470 </p> 471 472 <p> 473 {@code <activity>} {@code finishOnTaskLaunch} "{@code true}" <a href="#clearstack"></a> 474 </p> 475 476 477 <h2 id="procthread"></h2> 478 479 <p> 480 Android Linux 481 </p> 482 483 <p> 484 485 </p> 486 487 488 <h3 id="procs"></h3> 489 490 <p> 491 {@code <activity>}{@code <service>}{@code <receiver>} {@code <provider>} {@code process} Linux ID {@code <application>} {@code process} 492 </p> 493 494 <p> 495 1 <a href="#lcycles"> </a> <code>{@link android.view.View#onKeyDown View.onKeyDown()}</code> <a href="#threads"></a> 496 </p> 497 498 <p> 499 Android 500 </p> 501 502 <p> 503 Android <a href="#lcycles"></a> 504 </p> 505 506 507 <h3 id="threads"></h3> 508 509 <p> 510 511 </p> 512 513 <p> 514 Java {@link java.lang.Thread} Android {@link android.os.Looper} {@link android.os.Handler} {@link android.os.HandlerThread} 515 </p> 516 517 518 <h3 id="rpc"> </h3> 519 520 <p> 521 Android (RPC) RPC Android RPC RPC 522 </p> 523 524 <p> 525 RPC 526 </p> 527 528 <p> 529 IDL RPC <code><a href="{@docRoot}guide/components/aidl.html">aidl</a></code> RPC Java 2 : 530 </p> 531 532 <p style="margin-left: 2em"> 533 <img src="{@docRoot}images/binder_rpc.png" alt="RPC " /> 534 </p> 535 536 <p> 537 IDL {@link android.os.IBinder} {@link android.os.Binder} IPCIDL RPC ... 538 </p> 539 540 <p> 541 {@code aidl} RPC {@code aidl} 542 </p> 543 544 <p> 545 : 546 </p> 547 548 <ul> 549 <li> <code>{@link android.content.ServiceConnection#onServiceConnected 550 onServiceConnected()}</code> <code>{@link android.content.ServiceConnection#onServiceDisconnected 551 onServiceDisconnected()}</code> <code>{@link android.content.Context#bindService bindService()}</code> 552 </li> 553 554 <li> 555 <code>{@link android.app.Service#onBind onBind()}</code> {@code bindService()} 556 </li> 557 558 <li>Android {@code onServiceConnected()} IBinder 559 </li> 560 </ul> 561 562 <p> 563 RPC <a href="{@docRoot}guide/components/aidl.html">Designing a Remote Interface Using AIDL</a> {@link android.os.IBinder IBinder} 564 </p> 565 566 567 <h3 id="tsafe"></h3> 568 569 <p> 570 571 </p> 572 573 <p> 574 RPC IBinder IBinder IBinder {@code onBind()} {@code onBind()} RPC IBinder IBinder 575 </p> 576 577 <p> 578 ContentResolver ContentProvider ContentProvider <code>{@link android.content.ContentProvider#query query()}</code><code>{@link android.content.ContentProvider#insert insert()}</code><code>{@link android.content.ContentProvider#delete delete()}</code><code>{@link android.content.ContentProvider#update update()}</code> <code>{@link android.content.ContentProvider#getType getType()}</code> 579 </p> 580 581 582 <h2 id="lcycles"></h2> 583 584 <p> 585 586 </p> 587 588 589 <h3 id="actlife"></h3> 590 591 <p> 3 :</p> 592 593 <ul> 594 <li> <em></em><em></em></li> 595 596 <li><p><em></em> </p></li> 597 598 <li><p><em></em></p></li> 599 </ul> 600 601 <p> 602 {@link android.app.Activity#finish finish()} 603 </p> 604 605 <p> 606 protected : 607 </p> 608 609 <p style="margin-left: 2em">{@code void onCreate(Bundle <i>savedInstanceState</i>)} <br/>{@code void onStart()} <br/>{@code void onRestart()} <br/>{@code void onResume()} <br/>{@code void onPause()} <br/>{@code void onStop()} <br/>{@code void onDestroy()}</p> 610 611 <p> 612 <code>{@link android.app.Activity#onCreate onCreate()}</code> <code>{@link android.app.Activity#onPause onPause()}</code> 613 </p> 614 615 <div class="sidebox-wrapper"> 616 <div class="sidebox"> 617 <h2></h2> 618 <p> 619 : 620 </p> 621 622 <pre>protected void onPause() { 623 super.onPause(); 624 . . . 625 }</pre> 626 </div> 627 </div> 628 629 630 <p> 631 7 3 : 632 </p> 633 634 <ul> 635 <li><b></b><code>{@link android.app.Activity#onCreate onCreate()}</code> <code>{@link android.app.Activity#onDestroy}</code> {@code onCreate()} {@code onDestroy()} {@code onCreate()} {@code onDestroy()} </li> 636 637 <li><p><b></b><code>{@link android.app.Activity#onStart onStart()}</code> <code>{@link android.app.Activity#onStop onStop()}</code> 2 {@code onStart()} {@link android.content.BroadcastReceiver} UI {@code onStop()} {@code onStart()} {@code onStop()} </p></li> 638 639 <li><p><b> </b><code>{@link android.app.Activity#onResume onResume()}</code> <code>{@link android.app.Activity#onPause onPause()}</code> {@code onPause()} {@code onResume()} </p></li> 640 </ul> 641 642 <p> 643 644 <p> 645 646 <p style="margin-left: 2em"><img src="{@docRoot}images/activity_lifecycle.png" 647 alt="Android " /></p> 648 649 <p> 650 : 651 </p> 652 653 <table border="2" width="85%" frame="hsides" rules="rows"> 654 <colgroup align="left" span="3"></colgroup> 655 <colgroup align="left"></colgroup> 656 <colgroup align="center"></colgroup> 657 <colgroup align="center"></colgroup> 658 659 <thead> 660 <tr><th colspan="3"></th> <th></th> <th></th> <th></th></tr> 661 </thead> 662 663 <tbody> 664 <tr> 665 <td colspan="3" align="left"><code>{@link android.app.Activity#onCreate onCreate()}</code></td> 666 <td> Bundle <a href="#actstate"></a> 667 <p> {@code onStart()} </p></td> 668 <td align="center"></td> 669 <td align="center">{@code onStart()}</td> 670 </tr> 671 672 <tr> 673 <td rowspan="5" style="border-left: none; border-right: none;"> </td> 674 <td colspan="2" align="left"><code>{@link android.app.Activity#onRestart 675 onRestart()}</code></td> 676 <td> 677 <p> {@code onStart()} </p></td> 678 <td align="center"></td> 679 <td align="center">{@code onStart()}</td> 680 </tr> 681 682 <tr> 683 <td colspan="2" align="left"><code>{@link android.app.Activity#onStart onStart()}</code></td> 684 <td> 685 <p> {@code onResume()} {@code onStop()} </p></td> 686 <td align="center"></td> 687 <td align="center">{@code onResume()} <br/><br/>{@code onStop()}</td> 688 </tr> 689 690 <tr> 691 <td rowspan="2" style="border-left: none;"> </td> 692 <td align="left"><code>{@link android.app.Activity#onResume onResume()}</code></td> 693 <td> 694 <p> {@code onPause()} </p></td> 695 <td align="center"></td> 696 <td align="center">{@code onPause()}</td> 697 </tr> 698 699 <tr> 700 <td align="left"><code>{@link android.app.Activity#onPause onPause()}</code></td> 701 <td> CPU 702 <p> {@code onResume()} {@code onStop()} </td> 703 <td align="center"><strong style="color:#800000"></strong></td> 704 <td align="center">{@code onResume()} <br/><br/>{@code onStop()}</td> 705 </tr> 706 707 <tr> 708 <td colspan="2" align="left"><code>{@link android.app.Activity#onStop onStop()}</code></td> 709 <td> 710 <p> {@code onRestart()} {@code onDestroy()} </p></td> 711 <td align="center"><strong style="color:#800000"></strong></td> 712 <td align="center">{@code onRestart()} <br/><br/>{@code onDestroy()}</td> 713 </tr> 714 715 <tr> 716 <td colspan="3" align="left"><code>{@link android.app.Activity#onDestroy 717 onDestroy()}</code></td> 718 <td><code>{@link android.app.Activity#finish 719 finish()}</code> 2 <code>{@link 720 android.app.Activity#isFinishing isFinishing()}</code> </td> 721 <td align="center"><strong style="color:#800000"></strong></td> 722 <td align="center"><em></em></td> 723 </tr> 724 </tbody> 725 </table> 726 727 <p> 728 <b></b><em></em>{@code onPause()}{@code onStop()} {@code onDestroy()} 3 1 {@code onPause()} {@code onStop()} {@code onDestroy()} {@code onPause()} 729 </p> 730 731 <p> 732 <b></b> {@code onPause()} {@code onResume()} {@code onPause()} 733 </p> 734 735 <p> 736 <a href="#proclife"></a> 737 </p> 738 739 740 <h4 id="actstate"></h4> 741 742 <p> 743 744 </p> 745 746 <p> 747 <code>{@link android.app.Activity#onSaveInstanceState 748 onSaveInstanceState()}</code> {@code onPause()} / {@link android.os.Bundle} Bundle {@code onCreate()} {@code onStart()} <code>{@link 749 android.app.Activity#onRestoreInstanceState onRestoreInstanceState()}</code> 750 </p> 751 752 <p> 753 {@code onSaveInstanceState()} {@code onRestoreInstanceState()} {@code onPause()} {@code onSaveInstanceState()} [[]] 754 </p> 755 756 <p> 757 {@code onSaveInstanceState()} {@code onPause()} 758 </p> 759 760 761 <h4 id="coordact"></h4> 762 763 <p> 764 765 </p> 766 767 <p> 768 2 : 769 </p> 770 771 <ol> 772 <li> {@code onPause()} </li> 773 774 <li> {@code onCreate()}{@code onStart()} {@code onResume()} </li> 775 776 <li> {@code onStop()} </li> 777 </ol> 778 779 780 <h3 id="servlife"></h3> 781 782 <p> 783 2 : 784 </p> 785 786 <ul> 787 <li><code>{@link android.content.Context#startService Context.startService()}</code> <code>{@link android.content.Context#stopService Context.stopService()}</code> <code>{@link android.app.Service#stopSelf() Service.stopSelf()}</code> <code>{@link android.app.Service#stopSelfResult Service.stopSelfResult()}</code> {@code startService()} {@code stopService()} </li> 788 789 <li><p> Service <code>{@link android.content.Context#bindService Context.bindService()}</code> <code>{@link android.content.Context#unbindService Context.unbindService()}</code> {@code bindService()} 790 </p></li> 791 </ul> 792 793 <p> 794 2 {@code startService()} Intent {@code startService()} {@code bindService()} {@code stopService()} 795 </p> 796 797 <p> 798 protected public 3 : 799 </p> 800 801 <p style="margin-left: 2em">{@code void onCreate()} <br/>{@code void onStart(Intent <i>intent</i>)} <br/>{@code void onDestroy()}</p> 802 803 <p> 804 2 : 805 </p> 806 807 <ul> 808 <li><b></b><code>{@link android.app.Service#onCreate onCreate()}</code> <code>{@link android.app.Service#onDestroy}</code> {@code onCreate()} {@code onDestroy()} {@code onCreate()} {@code onDestroy()} </li> 809 810 <li><p><b> </b><code>{@link android.app.Service#onStart onStart()}</code> {@code startService()} Intent Intent </p> 811 812 <p> 813 {@code onStop()} 814 </p></li> 815 </ul> 816 817 <p> 818 {@code onCreate()} {@code onDestroy()} <code>{@link android.content.Context#startService Context.startService()}</code> <code>{@link android.content.Context#bindService Context.bindService()}</code> {@code onStart()} {@code startService()} 819 </p> 820 821 <p> 822 : 823 </p> 824 825 <p style="margin-left: 2em">{@code IBinder onBind(Intent <i>intent</i>)} <br/>{@code boolean onUnbind(Intent <i>intent</i>)} <br/>{@code void onRebind(Intent <i>intent</i>)}</p> 826 827 <p> 828 <code>{@link android.app.Service#onBind onBind()}</code> {@code bindService()} Intent <code>{@link android.app.Service#onUnbind onUnbind()}</code> {@code unbindService()} Intent {@code onBind()} {@code onUnbind()} <code>{@link android.app.Service#onRebind onRebind()}</code> 829 </p> 830 831 <p> 832 {@code startService()} {@code bindService()} {@code onBind()} {@code onUnbind()} 833 </p> 834 835 <p style="margin-left: 2em"><img src="{@docRoot}images/service_lifecycle.png" 836 alt=" " /></p> 837 838 839 <h3 id="broadlife"> </h3> 840 841 <p> 842 1 : 843 </p> 844 845 <p style="margin-left: 2em">{@code void onReceive(Context <i>curContext</i>, Intent <i>broadcastMsg</i>)}</p> 846 847 <p> 848 <code>{@link android.content.BroadcastReceiver#onReceive onReceive()}</code> Intent {@code onReceive()} 849 </p> 850 851 <p> 852 853 </p> 854 855 <p> 856 {@code onReceive()} {@code onReceive()} 857 </p> 858 859 <p> 860 861 </p> 862 863 864 <h3 id="proclife"></h3> 865 866 <p>Android Android 2 3 5 : 867 </p> 868 869 <ol> 870 871 <li><b> </b> : 872 873 <ul> 874 <li>Activity <code>{@link android.app.Activity#onResume 875 onResume()}</code> </li> 876 877 <li><p></p></li> 878 879 <li><p> <code>{@link android.app.Service#onCreate 880 onCreate()}</code><code>{@link android.app.Service#onStart onStart()}</code> <code>{@link android.app.Service#onDestroy onDestroy()}</code> {@link android.app.Service} </p></li> 881 882 <li><p><code>{@link android.content.BroadcastReceiver#onReceive 883 onReceive()}</code> {@link android.content.BroadcastReceiver} </p></li> 884 </ul> 885 886 <p> 887 888 </p></li> 889 890 <li><p><b></b> :</p> 891 892 <ul> 893 <li> <code>{@link android.app.Activity#onPause onPause()}</code> </li> 894 895 <li><p></p></li> 896 </ul> 897 898 <p> 899 900 </p></li> 901 902 <li><p><b> </b><code>{@link android.content.Context#startService startService()}</code> 2 MP3 903 </p></li> 904 905 <li><p><b> </b>Activity <code>{@link android.app.Activity#onStop onStop()}</code> LRUleast recently used 906 </p></li> 907 908 <li><p><b></b> </p></li> 909 910 </ol> 911 912 <p> 913 914 </p> 915 916 <p> 917 A B A B A B 918 </p> 919 920 <p> 921 Web <a href="#broadlife"> </a> 922 </p> 923