1 Introducing Activity and Intent. 2 Memory LinearLayout, weight=2 LinearLayout, weight=1 TextView ListView.

Slides:



Advertisements
Similar presentations
Android – CoNTENT PRoViders
Advertisements

Application Fundamentals. See: developer.android.com/guide/developing/building/index.html.
Who Am I And Why Am I Here I’m professor Stephen Fickas in CIS – you can call me Steve. I have a research group that works with mobile devices (since 1995!)
User Interface Android Applications. Activities An activity presents a visual user interface. Each activity is given a default window to draw in. The.
Android Form Elements. Views Provide common UI functionality Form elements: text area, button, radio button, checkbox, dropdown list, etc. Date and time.
Basic, Basic, Basic Android. What are Packages? Page 346 in text Package statement goes before any import statements Indicates that the class declared.
Android Application Development with Java UPenn CS4HS 2011 Chris Murphy
Cosc 4730 Android TabActivity and ListView. TabActivity A TabActivity allows for multiple “tabs”. – Each Tab is it’s own activity and the “root” activity.
@2011 Mihail L. Sichitiu1 Android Introduction Hello World.
Presenting Lists of Data. Lists of Data Issues involved – unknown number of elements – allowing the user to scroll Data sources – most common ArrayList.
Android Application Development Tutorial. Topics Lecture 5 Overview Overview of Networking Programming Tutorial 2: Downloading from the Internet.
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.
ANDROID – INTERFACE AND LAYOUT L. Grewe. Interfaces: Two Alternatives Code or XML  You have two ways you can create the interface(s) of your Application.
Mobile Programming Lecture 6
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.
1/29/ Android Programming: FrameLayout By Dr. Ramji M. Makwana Professor and Head, Computer Engineering Department A.D. Patel.
Import import android.graphics.Bitmap; import android.widget.ImageView;
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.
Copyright© Jeffrey Jongko, Ateneo de Manila University Deconstructing HelloWorld.
Android and s Ken Nguyen Clayton state University 2012.
Mobile Programming Lecture 4 Resources, Selection, Activities, Intents.
Android 基本 I/O. 基本 I/O 介面元件 在此節中主要介紹常見的 I/O 使用者介 面元件 – Button, TextView, 以及 EditText , 學習者可以學會: – Android 的視窗表單設計 res/layout/main.xml – Android SDK –
Http :// developer. android. com / guide / topics / fundamentals. html.
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
CMPE419 Mobile Application Development Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren
Android Embedded Resources Lesson16 Victor Matos Cleveland State University Notes are based on: Android Developers
Android Programming.
Lab7 – Appendix.
Android Programming - Features
Lecture 3 Zablon Ochomo Android Layouts Lecture 3 Zablon Ochomo
Android Introduction Hello World
Android Application Development 1 6 May 2018
Android N Amanquah.
UNIT 11 로봇 전화번호부 3/4 로봇 SW 콘텐츠 교육원 조용수.
Adapting to Display Orientation
GUI Programming Fundamentals
CS499 – Mobile Application Development
Android Introduction Hello World.
Android Notifications
Android Introduction Hello Views Part 1.
ITEC535 – Mobile Programming
Android Introduction Camera.
תכנות ב android אליהו חלסצ'י.
CIS 470 Mobile App Development
CIS 470 Mobile App Development
Android Programming Lecture 6
CIS 470 Mobile App Development
CIS 470 Mobile App Development
CMPE419 Mobile Application Development
CA16R405 - Mobile Application Development (Theory)
BMI Android Application will take weight and height from the users to calculate Body Mass Index (BMI) with the information, whether user is underweight,
CIS 470 Mobile App Development
CIS 470 Mobile App Development
CIS 470 Mobile App Development
Android Notifications
CMPE419 Mobile Application Development
Adding Components to Activity
CMPE419 Mobile Application Development
BLP 4216 MOBİL UYGULAMA GELİŞTİRME-2
CMPE419 Mobile Application Development
Lasalle-App Tecnología Móvil.
Android Sensor Programming
Android Sensor Programming
CIS 694/EEC 693 Android Sensor Programming
Android Sensor Programming
Presentation transcript:

1 Introducing Activity and Intent

2 Memory LinearLayout, weight=2 LinearLayout, weight=1 TextView ListView

3 How to create xml file Right click (on the folder)

4 The menu.xml <LinearLayout xmlns:android=" android:orientation="vertical" android:layout_width="fill_parent“ android:layout_height="fill_parent"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="2"> <TextView android:layout_width="wrap_content” android:layout_height="wrap_content“ android:layout_gravity="center" />

5 The menu.xml cont. <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent“ android:layout_weight="1"> <ListView android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_gravity="center_horizontal"

6 The dimens.xml (in values folder) 24pt 5pt 3pt 16pt 10pt 7pt 20px

7 The colors.xml (in values folder) #FFFF0F #f0f0f0 #1a1a48 #f0f0f0 #F00 #FFFF0F #F00

8 How to create java file Right click (on the folder)

9 How to override a method Right click on the code pane

10 How to override a method cont. Select the method to overridem eg, onCreate

11 The strings.xml (in values folder) …. Memory Settings Play Game View Scores Help …

12 Create ListView from resource ListView menuList = (ListView) findViewById(R.id.list_menu); String[] items = { getResources().getString(R.string.menu_item_play), getResources().getString(R.string.menu_item_scores), getResources().getString(R.string.menu_item_settings), getResources().getString(R.string.menu_item_help) }; ArrayAdapter adapt = new ArrayAdapter (this,R.layout.menu_item, items); menuList.setAdapter(adapt);

13 Starting an Activity class public class Memory extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.menu); ListView menuList = (ListView) findViewById(R.id.list_menu); String[] items = { getResources().getString(R.string.menu_item_play), getResources().getString(R.string.menu_item_scores), getResources().getString(R.string.menu_item_settings), getResources().getString(R.string.menu_item_help) }; ArrayAdapter adapt = new ArrayAdapter (this,R.layout.menu_item, items); menuList.setAdapter(adapt); menuList.setSelection(-1);

14 Starting an Activity class menuList.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView parent, View itemClicked, int position, long id) { // Note: if the list was built "by hand" the id could be used. // As-is, though, each item has the same id TextView textView = (TextView) itemClicked; String strText = textView.getText().toString(); if (strText.equalsIgnoreCase( getResources().getString(R.string.menu_item_play))) { startActivity(new Intent(Memory.this, MemoryPlayGame.class)); } else if (strText.equalsIgnoreCase(getResources().getString(R.string.menu_item_help))) { // startActivity(new Intent(Memory.this, MemoryHelp.class)); } }); }

15 Include the Activity in the manifest <manifest xmlns:android=" package="com.plearn" android:versionCode="1" android:versionName="1.0">