0
Computer Science E-69
Smartphone Application Development



Lecture 6: [Android] Activities & Tasks
March 2, 2010

Dan Arm...
package com.android.helloworld;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

p...
 public class Activity extends ApplicationContext {
     protected void onCreate(Bundle savedInstanceState);

     protect...
http://developer.android.com/reference/android/app/Activity.html




Activity    Lifecycle
                               ...
TextView tv = new TextView(this);
                 tv.setText("Hello, Android");


                              – or –
<?...
http://developer.android.com/guide/topics/ui/index.html




Views   Layouts
                                              ...
FrameLayout
Gallery
GridView
LinearLayout
ListView
RelativeLayout
ScrollView
Spinner
SurfaceView
TabHost
TableLayout
ViewF...
Computer Science E-69
Smartphone Application Development



Lecture 6: [Android] Activities & Tasks
March 2, 2010

Dan Arm...
Upcoming SlideShare
Loading in...5
×

Computer Science E-69 Smartphone Application Development

1,016

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,016
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
19
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Computer Science E-69 Smartphone Application Development"

  1. 1. Computer Science E-69 Smartphone Application Development Lecture 6: [Android] Activities & Tasks March 2, 2010 Dan Armendariz danallan@mit.edu 1
  2. 2. package com.android.helloworld; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class HelloWorld extends Activity {    /** Called when the activity is first created. */    @Override    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        TextView tv = new TextView(this);        tv.setText("Hello, World!");        setContentView(tv);    } } Code adapted from: http://developer.android.com/resources/tutorials/hello-world.html Android Hello, World! 2
  3. 3.  public class Activity extends ApplicationContext {      protected void onCreate(Bundle savedInstanceState);      protected void onStart();            protected void onRestart();      protected void onResume();      protected void onPause();      protected void onStop();      protected void onDestroy();  } http://developer.android.com/reference/android/app/Activity.html Activities Methods 3
  4. 4. http://developer.android.com/reference/android/app/Activity.html Activity Lifecycle 4
  5. 5. TextView tv = new TextView(this); tv.setText("Hello, Android"); – or – <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android"   android:layout_width="fill_parent"   android:layout_height="fill_parent"   android:text="@string/hello"/> http://developer.android.com/resources/tutorials/hello-world.html Activity Creating a UI 5
  6. 6. http://developer.android.com/guide/topics/ui/index.html Views Layouts 6
  7. 7. FrameLayout Gallery GridView LinearLayout ListView RelativeLayout ScrollView Spinner SurfaceView TabHost TableLayout ViewFlipper ViewSwitcher More: http://developer.android.com/reference/android/widget/package-summary.html Views Common Layouts 7
  8. 8. Computer Science E-69 Smartphone Application Development Lecture 6: [Android] Activities & Tasks March 2, 2010 Dan Armendariz danallan@mit.edu 8
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×