Home | History | Annotate | Download | only in app
      1 /*
      2  * Copyright (C) 2007 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 package com.example.android.apis.app;
     18 
     19 // Need the following import to get access to the app resources, since this
     20 // class is in a sub-package.
     21 import com.example.android.apis.R;
     22 
     23 import android.app.Activity;
     24 import android.os.Bundle;
     25 
     26 
     27 /**
     28  * Simple example of writing an application Activity.
     29  * Hello World</a></h3>
     30 
     31 <p>This demonstrates the basic code needed to write a Screen activity.</p>
     32 
     33 <h4>Demo</h4>
     34 App/Activity/Hello World
     35 
     36 <h4>Source files</h4>
     37  * <table class="LinkTable">
     38  *         <tr>
     39  *             <td >src/com.example.android.apis/app/HelloWorld.java</td>
     40  *             <td >The Hello World Screen implementation</td>
     41  *         </tr>
     42  *         <tr>
     43  *             <td >/res/any/layout/hello_world.xml</td>
     44  *             <td >Defines contents of the screen</td>
     45  *         </tr>
     46  * </table>
     47  */
     48 public class HelloWorld extends Activity
     49 {
     50     /**
     51      * Initialization of the Activity after it is first created.  Must at least
     52      * call {@link android.app.Activity#setContentView setContentView()} to
     53      * describe what is to be displayed in the screen.
     54      */
     55     @Override
     56 	protected void onCreate(Bundle savedInstanceState)
     57     {
     58         // Be sure to call the super class.
     59         super.onCreate(savedInstanceState);
     60 
     61         // See assets/res/any/layout/hello_world.xml for this
     62         // view layout definition, which is being set here as
     63         // the content of our screen.
     64         setContentView(R.layout.hello_world);
     65     }
     66 }
     67