Your SlideShare is downloading. ×
Computer Science E-69 Smartphone Application Development
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Computer Science E-69 Smartphone Application Development

997
views

Published on


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

  • Be the first to like this

No Downloads
Views
Total Views
997
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
18
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Computer Science E-69 Smartphone Application Development Lecture 6: [Android] Activities & Tasks March 2, 2010 Dan Armendariz danallan@mit.edu 1
  • 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.  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. http://developer.android.com/reference/android/app/Activity.html Activity Lifecycle 4
  • 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. http://developer.android.com/guide/topics/ui/index.html Views Layouts 6
  • 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. Computer Science E-69 Smartphone Application Development Lecture 6: [Android] Activities & Tasks March 2, 2010 Dan Armendariz danallan@mit.edu 8