Android Introduction Hello World

Slides:



Advertisements
Similar presentations
Android architecture overview
Advertisements

App Development for Android
Hello world Follow steps under the sections “Create an AVD” and “Create a New Android Project” at
Application Fundamentals. See: developer.android.com/guide/developing/building/index.html.
User Interface Android Applications. Activities An activity presents a visual user interface. Each activity is given a default window to draw in. The.
Client / Server Programming in Android Eclipse IDE Android Development Tools (ADT) Android SDK
Basic, Basic, Basic Android. What are Packages? Page 346 in text Package statement goes before any import statements Indicates that the class declared.
Android GUI Project John Hurley CS 454. Android 1. Android Basics 2. Android Development 3. Android UI 4. Hello, World 5. My Project.
App Development for Android Prabhaker Mateti. Development Tools (Android) Java – Java is the same. But, not all libs are included. – Unused: Swing, AWT,
Android Application Development with Java UPenn CS4HS 2011 Chris Murphy
Layout and Control in UI The user interface (UI) is the graphical interface user can see and interact with your app comprising UI controls like textbox,
@2011 Mihail L. Sichitiu1 Android Introduction Hello World.
Android Application Development Tutorial. Topics Lecture 5 Overview Overview of Networking Programming Tutorial 2: Downloading from the Internet.
Android Programming. Outline Preparation Create new project Build and Run a project Debug a project Deploy on devices.
1 Mobile Software Development Framework: Android Activity, View/ViewGroup, External Resources, Listener 10/9/2012 Y. Richard Yang.
Introduction to Android Programming Content Basic environmental structure Building a simple app Debugging.
Wireless Mobility with Android 1 Presented by: Ung Yean MS. Computer Science American University, Washington DC, USA.
Hello world Follow steps under the sections “Create an AVD” and “Create a New Android Project” at
Android Activities 1. What are Android Activities? Activities are like windows in an Android application An application can have any number of activities.
Social Media Apps Programming Min-Yuh Day, Ph.D. Assistant Professor Department of Information Management Tamkang University
1 Announcements Homework #2 due Feb 7 at 1:30pm Submit the entire Eclipse project in Blackboard Please fill out the when2meets when your Project Manager.
CE Applied Communications Technology Android lecture 2 - Structures Android File structure Resources Drawables Layout Values R Class Manifest Running.
Eclipse Tutorial Barrett Summer Scholars 2011 Sustainable Engineering: Learning to Engineer Truly Green Products.
Android - Broadcast Receivers
1 Introducing Activity and Intent. 2 Memory LinearLayout, weight=2 LinearLayout, weight=1 TextView ListView.
ANDROID – DRAWING IMAGES – SIMPLE EXAMPLE IN INTERFACE AND EVENT HANDLING L. Grewe.
Announcements Homework #2 will be posted after class due Thursday Feb 7, 1:30pm you may work with one other person No office hours tonight (sorry!) I will.
Android App Basics Dr. David Janzen Except as otherwise noted, the content of this presentation is licensed under the Creative Commons Attribution 2.5.
ANDROID – A FIRST PROGRAM L. Grewe Using AndroidStudio –basic Android  Lets do a “Hello World Project”  Start up AndroidStudio (assume you have installed.
Copyright© Jeffrey Jongko, Ateneo de Manila University Deconstructing HelloWorld.
Android and s Ken Nguyen Clayton state University 2012.
Mobile Computing Lecture#12 Graphics & Animation.
Android 基本 I/O. 基本 I/O 介面元件 在此節中主要介紹常見的 I/O 使用者介 面元件 – Button, TextView, 以及 EditText , 學習者可以學會: – Android 的視窗表單設計 res/layout/main.xml – Android SDK –
CMPE419 Mobile Application Development Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren
CMPE419 Mobile Application Development Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren
Android Programming.
Lab7 – Appendix.
Android Application Development
Introduction to ANDROID
Android Programming - Features
Lecture 3 Zablon Ochomo Android Layouts Lecture 3 Zablon Ochomo
Android Application Development 1 6 May 2018
Android N Amanquah.
Android Intent Filters
Adapting to Display Orientation
GUI Programming Fundamentals
Android Introduction Hello World.
Android External Resources
Android Notifications
XML Mihail L. Sichitiu.
CS499 – Mobile Application Development
Android Introduction Hello Views Part 1.
ITEC535 – Mobile Programming
Android Introduction Camera.
תכנות ב android אליהו חלסצ'י.
Mobile Device Development
Android GUI Project John Hurley CS 454.
CIS 470 Mobile App Development
MultiUni Trần Vũ Tất Bình
Many thanks to Jun Bum Lim for his help with this tutorial.
Android GUI Project John Hurley CS 454.
CMPE419 Mobile Application Development
BMI Android Application will take weight and height from the users to calculate Body Mass Index (BMI) with the information, whether user is underweight,
Programski jezici za mobilne aplikacije
CIS 470 Mobile App Development
Android Notifications
CMPE419 Mobile Application Development
CMPE419 Mobile Application Development
Android Sensor Programming
Android Sensor Programming
Presentation transcript:

Android Introduction Hello World http://www.tutorialspoint.com/android/android_hello_world_example.htm

Goal Create a very simple application Run it on a real device Run it on the emulator Examine its structure

Google Tutorial Start Eclipse (Start -> All Programs -> Eclipse) Create an Android Virtual Device (AVD) Create a New Android Project

Package Content All source code here Java code for our activity Generated Java code Helps link resources to Java code All non-code resources Layout of the activity Images Strings used in the program Android Manifest

Android Manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.helloandroid" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".HelloAndroid" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>

Activity An Android activity is focused on a single thing a user can do. Most applications have multiple activities

Activities start each other

HelloAndroid.java Inherit from the Activity Class package com.example.helloandroid; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class HelloAndroid 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, Android – by hand");        setContentView(tv);    } } Set the view “by hand” – from the program

Run it!

/res/layout/main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_height="wrap_content" android:text="@string/hello" /> </LinearLayout> Further redirection to /res/values/strings.xml

/res/values/strings.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string name="hello">Hello World, HelloAndroid – by resources!</string> <string name="app_name">Hello, Android</string> </resources>

HelloAndroid.java package com.example.helloandroid; import android.app.Activity; import android.os.Bundle; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } Set the layout of the view as described in the main.xml layout

/gen/R.java package com.example.helloandroid; public final class R {     public static final class attr {     }     public static final class drawable {         public static final int icon=0x7f020000;     }     public static final class id {         public static final int textview=0x7f050000;     }     public static final class layout {         public static final int main=0x7f030000;     }     public static final class string {         public static final int app_name=0x7f040001;         public static final int hello=0x7f040000;     } }