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

Like this? Share it with your network

Share

Computer Science E-69 Smartphone Application Development

  • 1,418 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,418
On Slideshare
1,417
From Embeds
1
Number of Embeds
1

Actions

Shares
Downloads
18
Comments
0
Likes
0

Embeds 1

http://www.slideshare.net 1

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