Home | History | Annotate | Download | only in Application
      1 <!--
      2         Copyright 2013 The Android Open Source Project
      3 
      4         Licensed under the Apache License, Version 2.0 (the "License");
      5         you may not use this file except in compliance with the License.
      6         You may obtain a copy of the License at
      7 
      8         http://www.apache.org/licenses/LICENSE-2.0
      9 
     10         Unless required by applicable law or agreed to in writing, software
     11         distributed under the License is distributed on an "AS IS" BASIS,
     12         WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13         See the License for the specific language governing permissions and
     14         limitations under the License.
     15 -->
     16 
     17 Steps to implement FragmentView template:
     18 -in template-params.xml.ftl:
     19     -add the following line to common imports
     20         <common src="activities"/>
     21 
     22 -Add a Fragment to show behavior.  In your MainActivity.java class, it will reference a Fragment
     23  called (yourProjectName)Fragment.java.  Create that file in your project, using the "main" source
     24  folder instead of "common" or "templates".
     25    For instance, if your package name is com.example.foo, create the file
     26    src/main/java/com/example/foo/FooFragment.java
     27 
     28 
     29 -Within this fragment, make sure that the onCreate method has the line
     30  "setHasOptionsMenu(true);", to enable the fragment to handle menu events.
     31 
     32 -In order to override menu events, override onOptionsItemSelected.
     33 
     34 -refer to sampleSamples/fragmentViewSample for a reference implementation of a
     35 project built on this template.
     36 
     37 
     38