1 page.title= 2 parent.title= 3 parent.link=activities.html 4 @jd:body 5 6 <div id="qv-wrapper"> 7 <div id="qv"> 8 <h2> </h2> 9 <ol> 10 <li><a href="#Design"> </a></li> 11 <li><a href="#Creating"> </a> 12 <ol> 13 <li><a href="#UI"> </a></li> 14 <li><a href="#Adding"> </a></li> 15 </ol> 16 </li> 17 <li><a href="#Managing"> </a></li> 18 <li><a href="#Transactions"> </a></li> 19 <li><a href="#CommunicatingWithActivity"> </a> 20 <ol> 21 <li><a href="#EventCallbacks"> </a></li> 22 <li><a href="#ActionBar"> </a></li> 23 </ol> 24 </li> 25 <li><a href="#Lifecycle"> </a> 26 <ol> 27 <li><a href="#CoordinatingWithActivity"> </a></li> 28 </ol> 29 </li> 30 <li><a href="#Example"></a></li> 31 </ol> 32 33 <h2>Key </h2> 34 <ol> 35 <li>{@link android.app.Fragment}</li> 36 <li>{@link android.app.FragmentManager}</li> 37 <li>{@link android.app.FragmentTransaction}</li> 38 </ol> 39 40 <h2> </h2> 41 <ol> 42 <li><a href="{@docRoot}training/basics/fragments/index.html"> UI </a></li> 43 <li><a href="{@docRoot}guide/practices/tablets-and-handsets.html"> 44 </a></li> 45 </ol> 46 </div> 47 </div> 48 49 <p>{@link android.app.Fragment} 50 {@link android.app.Activity} . 51 UI , . , , 52 53 ( 54 " " ).</p> 55 56 <p> 57 . , 58 . 59 (<em></em> <a href="{@docRoot}guide/components/activities.html#Lifecycle"> </a> ) 60 . 61 62 . 63 . ( ). 64 <em></em> .</p> 65 66 <p> , {@link 67 android.view.ViewGroup} , 68 . 69 70 {@code <fragment>} , 71 {@link android.view.ViewGroup} . 72 . UI 73 .</p> 74 75 <p> 76 . , 77 78 .</p> 79 80 81 <h2 id="Design"> </h2> 82 83 <p>Android Android 3.0(API 11). 84 UI . 85 UI 86 . 87 . 88 89 .</p> 90 91 <p> 92 . 93 , 94 . , 95 96 . 1 .</p> 97 98 <p> . 99 , 100 . 101 . 102 . 103 , 104 . 105 UI . 106 .</p> 107 108 <img src="{@docRoot}images/fundamentals/fragments.png" alt="" /> 109 <p class="img-caption"><strong> 1.</strong> UI 110 111 .</p> 112 113 <p> — — , 114 <em> A</em> . 115 . 116 <em> A</em> , 117 <em> B</em> . . 118 119 ( 1 ).</p> 120 121 <p> 122 <a href="{@docRoot}guide/practices/tablets-and-handsets.html"> </a> .</p> 123 124 125 126 <h2 id="Creating"> </h2> 127 128 <div class="figure" style="width:327px"> 129 <img src="{@docRoot}images/fragment_lifecycle.png" alt="" /> 130 <p class="img-caption"><strong> 2.</strong> ( 131 ).</p> 132 </div> 133 134 <p> {@link android.app.Fragment} ( 135 ) . {@link android.app.Fragment} 136 {@link android.app.Activity} . . 137 {@link android.app.Fragment#onCreate onCreate()}, {@link android.app.Fragment#onStart onStart()}, 138 {@link android.app.Fragment#onPause onPause()} {@link android.app.Fragment#onStop onStop()} . , 139 Android 140 141 .</p> 142 143 <p> .</p> 144 145 <dl> 146 <dt>{@link android.app.Fragment#onCreate onCreate()}</dt> 147 <dd> . 148 149 .</dd> 150 <dt>{@link android.app.Fragment#onCreateView onCreateView()}</dt> 151 <dd> 152 . UI {@link android.view.View} . 153 . UI null 154 .</dd> 155 <dt>{@link android.app.Activity#onPause onPause()}</dt> 156 <dd> 157 ( ). 158 ( 159 ).</dd> 160 </dl> 161 162 <p> 163 , 164 . 165 <a href="#Lifecycle"> </a> .</p> 166 167 168 <p>, {@link 169 android.app.Fragment} .</p> 170 171 <dl> 172 <dt>{@link android.app.DialogFragment}</dt> 173 <dd> . 174 {@link android.app.Activity} 175 . , 176 .</dd> 177 178 <dt>{@link android.app.ListFragment}</dt> 179 <dd> (: {@link 180 android.widget.SimpleCursorAdapter}) , {@link android.app.ListActivity} . 181 . {@link 182 android.app.ListFragment#onListItemClick(ListView,View,int,long) onListItemClick()} 183 .</dd> 184 185 <dt>{@link android.preference.PreferenceFragment}</dt> 186 <dd>{@link android.preference.Preference} , 187 {@link android.preference.PreferenceActivity} . 188 "" .</dd> 189 </dl> 190 191 192 <h3 id="UI"> </h3> 193 194 <p> 195 .</p> 196 197 <p> {@link 198 android.app.Fragment#onCreateView onCreateView()} . 199 Android . 200 {@link android.view.View} . .</p> 201 202 <p class="note"><strong>:</strong> {@link 203 android.app.ListFragment} , 204 {@link android.app.Fragment#onCreateView onCreateView()} {@link android.widget.ListView} .</p> 205 206 <p>{@link 207 android.app.Fragment#onCreateView onCreateView()} XML <a href="{@docRoot}guide/topics/resources/layout-resource.html"> </a> . 208 {@link android.app.Fragment#onCreateView onCreateView()} 209 {@link android.view.LayoutInflater} .</p> 210 211 <p> {@link android.app.Fragment} . 212 {@code example_fragment.xml} .</p> 213 214 <pre> 215 public static class ExampleFragment extends Fragment { 216 @Override 217 public View onCreateView(LayoutInflater inflater, ViewGroup container, 218 Bundle savedInstanceState) { 219 // Inflate the layout for this fragment 220 return inflater.inflate(R.layout.example_fragment, container, false); 221 } 222 } 223 </pre> 224 225 <div class="sidebox-wrapper"> 226 <div class="sidebox"> 227 <h3> </h3> 228 <p> {@code R.layout.example_fragment} 229 {@code example_fragment.xml} . 230 XML <a href="{@docRoot}guide/topics/ui/index.html"> </a> 231 .</p> 232 </div> 233 </div> 234 235 <p>{@link android.app.Fragment#onCreateView 236 onCreateView()} {@code container} {@link android.view.ViewGroup}( ), 237 . 238 {@code savedInstanceState} {@link android.os.Bundle}, 239 240 ( <a href="#Lifecycle"> 241 </a> ).</p> 242 243 <p>{@link android.view.LayoutInflater#inflate(int,ViewGroup,boolean) inflate()} 244 .</p> 245 <ul> 246 <li> ID.</li> 247 <li> {@link android.view.ViewGroup}. {@code 248 container} 249 .</li> 250 <li> {@link 251 android.view.ViewGroup}( ) ( , 252 . {@code 253 container} . ).</li> 254 </ul> 255 256 <p> . 257 .</p> 258 259 260 261 <h3 id="Adding"> </h3> 262 263 <p> UI . 264 . 265 .</p> 266 267 <ul> 268 <li><b> .</b> 269 <p> , 270 . 271 .</p> 272 <pre> 273 <?xml version="1.0" encoding="utf-8"?> 274 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 275 android:orientation="horizontal" 276 android:layout_width="match_parent" 277 android:layout_height="match_parent"> 278 <fragment android:name="com.example.news.ArticleListFragment" 279 android:id="@+id/list" 280 android:layout_weight="1" 281 android:layout_width="0dp" 282 android:layout_height="match_parent" /> 283 <fragment android:name="com.example.news.ArticleReaderFragment" 284 android:id="@+id/viewer" 285 android:layout_weight="2" 286 android:layout_width="0dp" 287 android:layout_height="match_parent" /> 288 </LinearLayout> 289 </pre> 290 <p>{@code <fragment>} {@code android:name} {@link 291 android.app.Fragment} .</p> 292 293 <p> 294 {@link android.app.Fragment#onCreateView onCreateView()} 295 . {@link android.view.View} 296 {@code <fragment>} .</p> 297 298 <div class="note"> 299 <p><strong>:</strong> 300 (, 301 ). ID 302 .</p> 303 <ul> 304 <li> ID {@code android:id} .</li> 305 <li> {@code android:tag} .</li> 306 <li> , ID 307 .</li> 308 </ul> 309 </div> 310 </li> 311 312 <li><b>, {@link android.view.ViewGroup} .</b> 313 <p> . 314 {@link 315 android.view.ViewGroup} .</p> 316 <p> ( , 317 ), {@link android.app.FragmentTransaction} API . 318 {@link android.app.FragmentTransaction} {@link android.app.Activity} .</p> 319 320 <pre> 321 FragmentManager fragmentManager = {@link android.app.Activity#getFragmentManager()} 322 FragmentTransaction fragmentTransaction = fragmentManager.{@link android.app.FragmentManager#beginTransaction()}; 323 </pre> 324 325 <p> {@link 326 android.app.FragmentTransaction#add(int,Fragment) add()} , 327 . :</p> 328 329 <pre> 330 ExampleFragment fragment = new ExampleFragment(); 331 fragmentTransaction.add(R.id.fragment_container, fragment); 332 fragmentTransaction.commit(); 333 </pre> 334 335 <p>{@link android.app.FragmentTransaction#add(int,Fragment) add()} 336 {@link android.view.ViewGroup}. 337 ID , .</p> 338 <p> 339 {@link android.app.FragmentTransaction} , 340 {@link android.app.FragmentTransaction#commit} .</p> 341 </li> 342 </ul> 343 344 345 <h4 id="AddingWithoutUI">UI </h4> 346 347 <p> UI . 348 UI 349 .</p> 350 351 <p>UI {@link 352 android.app.FragmentTransaction#add(Fragment,String)} (, 353 ID "" ). , 354 {@link 355 android.app.Fragment#onCreateView onCreateView()} . .</p> 356 357 <p> UI . UI 358 . 359 UI . 360 , {@link android.app.FragmentManager#findFragmentByTag 361 findFragmentByTag()} .</p> 362 363 <p> UI . {@code 364 FragmentRetainInstance.java} 365 SDK (Android SDK Manager ), 366 <code><sdk_root>/APIDemos/app/src/main/java/com/example/android/apis/app/FragmentRetainInstance.java</code> .</p> 367 368 369 370 <h2 id="Managing"> </h2> 371 372 <p> {@link android.app.FragmentManager} . 373 {@link android.app.Activity#getFragmentManager()} .</p> 374 375 <p>{@link android.app.FragmentManager} .</p> 376 377 <ul> 378 <li> {@link 379 android.app.FragmentManager#findFragmentById findFragmentById()} ( 380 UI ) {@link android.app.FragmentManager#findFragmentByTag 381 findFragmentByTag()} (UI ).</li> 382 <li> {@link 383 android.app.FragmentManager#popBackStack()} ( <em></em> ).</li> 384 <li> {@link 385 android.app.FragmentManager#addOnBackStackChangedListener addOnBackStackChangedListener()} .</li> 386 </ul> 387 388 <p> {@link 389 android.app.FragmentManager} .</p> 390 391 <p> {@link android.app.FragmentManager} 392 {@link android.app.FragmentTransaction} 393 . .</p> 394 395 396 <h2 id="Transactions"> </h2> 397 398 <p> , 399 , . 400 . {@link 401 android.app.FragmentTransaction} API . 402 . ( 403 ).</p> 404 405 <p>{@link android.app.FragmentTransaction} {@link 406 android.app.FragmentManager} .</p> 407 408 <pre> 409 FragmentManager fragmentManager = {@link android.app.Activity#getFragmentManager()}; 410 FragmentTransaction fragmentTransaction = fragmentManager.{@link android.app.FragmentManager#beginTransaction()}; 411 </pre> 412 413 <p> . 414 {@link 415 android.app.FragmentTransaction#add add()}, {@link android.app.FragmentTransaction#remove remove()}, 416 {@link android.app.FragmentTransaction#replace replace()} . , 417 {@link android.app.FragmentTransaction#commit()} .</p> 418 </dl> 419 420 <p> {@link 421 android.app.FragmentTransaction#commit()} . {@link 422 android.app.FragmentTransaction#addToBackStack addToBackStack()}. 423 . , 424 . <em></em> .</p> 425 426 <p> 427 .</p> 428 429 <pre> 430 // Create new fragment and transaction 431 Fragment newFragment = new ExampleFragment(); 432 FragmentTransaction transaction = getFragmentManager().beginTransaction(); 433 434 // Replace whatever is in the fragment_container view with this fragment, 435 // and add the transaction to the back stack 436 transaction.replace(R.id.fragment_container, newFragment); 437 transaction.addToBackStack(null); 438 439 // Commit the transaction 440 transaction.commit(); 441 </pre> 442 443 <p> {@code newFragment} 444 ( ) . {@code R.id.fragment_container} ID . {@link 445 android.app.FragmentTransaction#addToBackStack addToBackStack()} 446 , 447 . <em></em> .</p> 448 449 <p> ( {@link 450 android.app.FragmentTransaction#add add()} {@link android.app.FragmentTransaction#remove 451 remove()}) {@link 452 android.app.FragmentTransaction#addToBackStack addToBackStack()} , {@link android.app.FragmentTransaction#commit commit()} 453 , <em></em> 454 .</p> 455 456 <p>{@link android.app.FragmentTransaction} . 457 .</p> 458 <ul> 459 <li>{@link android.app.FragmentTransaction#commit()} .</li> 460 <li> , 461 .</li> 462 </ul> 463 464 <p> {@link android.app.FragmentTransaction#addToBackStack(String) 465 addToBackStack()} , 466 . 467 {@link android.app.FragmentTransaction#addToBackStack(String) addToBackStack()} , 468 <em></em> 469 .</p> 470 471 <p class="note"><strong>:</strong> 472 {@link android.app.FragmentTransaction#setTransition setTransition()} 473 .</p> 474 475 <p>{@link android.app.FragmentTransaction#commit()} 476 . , UI ("" ) 477 . UI {@link 478 android.app.FragmentManager#executePendingTransactions()} 479 {@link android.app.FragmentTransaction#commit()} . 480 .</p> 481 482 <p class="caution"><strong>:</strong> {@link 483 android.app.FragmentTransaction#commit commit()} <a href="{@docRoot}guide/components/activities.html#SavingActivityState"> 484 </a> ( ). 485 . 486 . , {@link 487 android.app.FragmentTransaction#commitAllowingStateLoss()} .</p> 488 489 490 491 492 <h2 id="CommunicatingWithActivity"> </h2> 493 494 <p>{@link android.app.Fragment} 495 {@link android.app.Activity} , 496 .</p> 497 498 <p> , {@link 499 android.app.Fragment#getActivity()} {@link android.app.Activity} 500 .</p> 501 502 <pre> 503 View listView = {@link android.app.Fragment#getActivity()}.{@link android.app.Activity#findViewById findViewById}(R.id.list); 504 </pre> 505 506 <p> , . {@link android.app.FragmentManager} 507 {@link android.app.Fragment} , {@link 508 android.app.FragmentManager#findFragmentById findFragmentById()} {@link 509 android.app.FragmentManager#findFragmentByTag findFragmentByTag()} . :</p> 510 511 <pre> 512 ExampleFragment fragment = (ExampleFragment) getFragmentManager().findFragmentById(R.id.example_fragment); 513 </pre> 514 515 516 <h3 id="EventCallbacks"> </h3> 517 518 <p> . 519 520 . , 521 .</p> 522 523 <p> . 524 ( A) ( B) 525 A B . , 526 {@code OnArticleSelectedListener} A .</p> 527 528 <pre> 529 public static class FragmentA extends ListFragment { 530 ... 531 // Container Activity must implement this interface 532 public interface OnArticleSelectedListener { 533 public void onArticleSelected(Uri articleUri); 534 } 535 ... 536 } 537 </pre> 538 539 <p> {@code OnArticleSelectedListener} 540 541 {@code onArticleSelected()} A 542 B . 543 A {@link 544 android.app.Fragment#onAttach onAttach()} ( ) {@code OnArticleSelectedListener} . {@link android.app.Fragment#onAttach 545 onAttach()} {@link android.app.Activity} 546 .</p> 547 548 <pre> 549 public static class FragmentA extends ListFragment { 550 OnArticleSelectedListener mListener; 551 ... 552 @Override 553 public void onAttach(Activity activity) { 554 super.onAttach(activity); 555 try { 556 mListener = (OnArticleSelectedListener) activity; 557 } catch (ClassCastException e) { 558 throw new ClassCastException(activity.toString() + " must implement OnArticleSelectedListener"); 559 } 560 } 561 ... 562 } 563 </pre> 564 565 <p> , 566 {@link java.lang.ClassCastException} . 567 , {@code mListener} 568 {@code OnArticleSelectedListener} , A . 569 {@code OnArticleSelectedListener} . A 570 {@link android.app.ListFragment} , 571 {@link android.app.ListFragment#onListItemClick 572 onListItemClick()} , {@code onArticleSelected()} 573 .</p> 574 575 <pre> 576 public static class FragmentA extends ListFragment { 577 OnArticleSelectedListener mListener; 578 ... 579 @Override 580 public void onListItemClick(ListView l, View v, int position, long id) { 581 // Append the clicked item's row ID with the content provider Uri 582 Uri noteUri = ContentUris.{@link android.content.ContentUris#withAppendedId withAppendedId}(ArticleColumns.CONTENT_URI, id); 583 // Send the event and Uri to the host activity 584 mListener.onArticleSelected(noteUri); 585 } 586 ... 587 } 588 </pre> 589 590 <p>{@link 591 android.app.ListFragment#onListItemClick onListItemClick()} {@code id} ID, 592 ( ) {@link 593 android.content.ContentProvider} .</p> 594 595 <p><!--To see a complete implementation of this kind of callback interface, see the <a 596 href="{@docRoot}resources/samples/NotePad/index.html">NotePad sample</a>. --> 597 <a href="{@docRoot}guide/topics/providers/content-providers.html"> </a> .</p> 598 599 600 601 <h3 id="ActionBar"> </h3> 602 603 <p> <a href="{@docRoot}guide/topics/ui/menus.html#options-menu"> </a>( <a href="{@docRoot}guide/topics/ui/actionbar.html"> </a>) . 604 {@link android.app.Fragment#onCreateOptionsMenu(Menu,MenuInflater) onCreateOptionsMenu()} . 605 , {@link 606 android.app.Fragment#onCreate(Bundle) onCreate()} {@link 607 android.app.Fragment#setHasOptionsMenu(boolean) setHasOptionsMenu()} 608 ( 609 {@link android.app.Fragment#onCreateOptionsMenu onCreateOptionsMenu()} ).</p> 610 611 <p> 612 . {@link 613 android.app.Fragment#onOptionsItemSelected(MenuItem) onOptionsItemSelected()} 614 .</p> 615 616 <p> . {@link 617 android.app.Fragment#registerForContextMenu(View) registerForContextMenu()} . , 618 {@link 619 android.app.Fragment#onCreateContextMenu(ContextMenu,View,ContextMenu.ContextMenuInfo) 620 onCreateContextMenu()} . , {@link 621 android.app.Fragment#onContextItemSelected(MenuItem) onContextItemSelected()} .</p> 622 623 <p class="note"><strong>:</strong> ' ' 624 , 625 . ' ' , 626 . 627 .</p> 628 629 <p> <a href="{@docRoot}guide/topics/ui/menus.html"></a> <a href="{@docRoot}guide/topics/ui/actionbar.html"> </a> .</p> 630 631 632 633 634 <h2 id="Lifecycle"> </h2> 635 636 <div class="figure" style="width:350px"> 637 <img src="{@docRoot}images/activity_fragment_lifecycle.png" alt="" /> 638 <p class="img-caption"><strong> 3.</strong> 639 .</p> 640 </div> 641 642 <p> . 643 .</p> 644 645 <dl> 646 <dt><i></i></dt> 647 <dd> .</dd> 648 649 <dt><i></i></dt> 650 <dd> , 651 ( 652 ).</dd> 653 654 <dt><i></i></dt> 655 <dd> . 656 . 657 ( ). , 658 .</dd> 659 </dl> 660 661 <p> , {@link 662 android.os.Bundle} . 663 . {@link 664 android.app.Fragment#onSaveInstanceState onSaveInstanceState()} , 665 {@link android.app.Fragment#onCreate onCreate()}, {@link 666 android.app.Fragment#onCreateView onCreateView()} {@link 667 android.app.Fragment#onActivityCreated onActivityCreated()} . 668 <a href="{@docRoot}guide/components/activities.html#SavingActivityState"></a> 669 .</p> 670 671 <p> 672 . 673 ( <em></em> 674 . <a href="{@docRoot}guide/components/tasks-and-back-stack.html"> </a> ). 675 , . 676 {@link 677 android.app.FragmentTransaction#addToBackStack(String) addToBackStack()} 678 .</p> 679 680 <p> , 681 . , <a href="{@docRoot}guide/components/activities.html#Lifecycle"> 682 </a> . . , 683 .</p> 684 685 <p class="caution"><strong>:</strong> {@link android.app.Fragment} {@link android.content.Context} 686 , {@link android.app.Fragment#getActivity()} . 687 {@link android.app.Fragment#getActivity()} 688 . , 689 {@link android.app.Fragment#getActivity()} null .</p> 690 691 692 <h3 id="CoordinatingWithActivity"> </h3> 693 694 <p> 695 . 696 . {@link android.app.Activity#onPause} , 697 {@link android.app.Fragment#onPause} .</p> 698 699 <p> . 700 UI 701 . .</p> 702 703 <dl> 704 <dt>{@link android.app.Fragment#onAttach onAttach()}</dt> 705 <dd> ( {@link 706 android.app.Activity} ).</dd> 707 <dt>{@link android.app.Fragment#onCreateView onCreateView()}</dt> 708 <dd> .</dd> 709 <dt>{@link android.app.Fragment#onActivityCreated onActivityCreated()}</dt> 710 <dd> {@link android.app.Activity#onCreate 711 onCreate()} .</dd> 712 <dt>{@link android.app.Fragment#onDestroyView onDestroyView()}</dt> 713 <dd> .</dd> 714 <dt>{@link android.app.Fragment#onDetach onDetach()}</dt> 715 <dd> .</dd> 716 </dl> 717 718 <p> 3 719 . 720 . {@link 721 android.app.Activity#onCreate onCreate()} , 722 {@link android.app.Fragment#onActivityCreated onActivityCreated()} .</p> 723 724 <p> 725 . , 726 .</p> 727 728 <p> 729 .</p> 730 731 732 733 734 <h2 id="Example"></h2> 735 736 <p> , 737 . 738 , 739 . 740 .</p> 741 742 <p class="note"><strong>:</strong> 743 <a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.html">{@code 744 FragmentLayout.java}</a> .</p> 745 746 <p> {@link 747 android.app.Activity#onCreate onCreate()} .</p> 748 749 {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java main} 750 751 <p> {@code fragment_layout.xml}.</p> 752 753 {@sample development/samples/ApiDemos/res/layout-land/fragment_layout.xml layout} 754 755 <p> {@code TitlesFragment} ( 756 ). {@link android.widget.FrameLayout} 757 ( ) 758 . , 759 {@link android.widget.FrameLayout} .</p> 760 761 <p> 762 . , 763 {@code res/layout-land/fragment_layout.xml} .</p> 764 765 <p> , . 766 {@code res/layout/fragment_layout.xml} .</p> 767 768 {@sample development/samples/ApiDemos/res/layout/fragment_layout.xml layout} 769 770 <p> {@code TitlesFragment} . 771 . , 772 773 .</p> 774 775 <p>, . {@code 776 TitlesFragment}, . {@link 777 android.app.ListFragment} .</p> 778 779 <p> 780 . 781 ( {@link 782 android.widget.FrameLayout} ), ( ).</p> 783 784 {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java titles} 785 786 <p> {@code DetailsFragment} {@code TitlesFragment} 787 .</p> 788 789 {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java details} 790 791 <p>{@code TitlesFragment} , 792 {@code R.id.details} <em></em> ( 793 {@code DetailsFragment} ), {@code DetailsActivity} 794 .</p> 795 796 <p> {@code DetailsFragment} 797 {@code DetailsActivity}.</p> 798 799 {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java 800 details_activity} 801 802 <p> . 803 {@code DetailsFragment} {@code TitlesFragment} . 804 {@code DetailsActivity} 805 ( ) .</p> 806 807 808 <p> ( ) 809 <a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/index.html#Fragment"> 810 ApiDemos</a> API Demos (<a href="{@docRoot}resources/samples/get.html"> SDK </a> ).</p> 811 812 813