SlideShare a Scribd company logo
1 of 29
行動APP開發管理實務
Android應用程式開發基礎
開發準備、基本控制項、Layout
尹君耀 Xavier Yin
Outline
 開發App的事前準備
 Project Structure
 基本控制項
 Intent
 Events
 Intent
 練習
 作業
事前準備
 建立應用程式的基本資訊
– 決定開發版本
– 決定欲使用的Android設備
– 考量所需使用的硬體設備資訊
(AndroidManifest.xml)
 應用程式的需求分析與規劃
– 功能需求
– 介面
 應用程式的資源
– 文字或文案、顏色、尺寸、動畫、
圖片、畫面、樣式、音樂或影片、
檔案…等等。
事前準備
 Android開發環境
– JDK
 Download JDK (or from Oracle)
 Installation and Environment Variable Settings
– JAVA_HOME
– PATH
– Installation result on cmd
– Android SDK and Studio
 Download Android SDK and Studio (or from Android Developer)
 Installation
– Launch the .exe file you just downloaded
– Follow the setup wizard
事前準備
 撰寫應用程式
 測試和安裝
– Real Devices
– Emulator
 AVD
 Genymotion
Project Structure
 /app
– /src
 /main/java
– /your_package_name (ex: /com/tku/android -> com.tku.android)
 Java files
– AndroidManifest.xml
 /androidTest(For Android Test)
– /java/your_package_name
 Test cases
 /res
– /drawable
– /layout
– /values
 colors.xml, dimens.xml, strings.xml, styles.xml…etc.
 build.gradle
App Manifest
 Manifest file
– The manifest file presents essential information about your app to the
Android system, information the system must have before it can run
any of the app's code.
 Permission
– A basic Android application has no permissions associated with it by
default, meaning it cannot do anything that would adversely impact
the user experience or any data on the device.
– To make use of protected features of the device, you must include in
your AndroidManifest.xml one or more <uses-permission> tags
declaring the permissions that your application needs.
App Manifest
Resources
 系統資源
– android.R.anim – 系統動畫資源。
– android.R.color – 系統顏色狀態資源。
– android.R.dimen – 系統尺寸資源。
– android.R.drawable – 系統圖形與繪圖資源。
– android.R.layout – 系統畫面配置資源。
– android.R.menu – 系統選單資源。
– android.R.string – 系統文字資源。
– android.R.style – 系統樣式資源。
 一般資源
– strings.xml – 文字資源。
– colors.xml – 顏色資源。
– dimens.xml – 尺寸資源。
– arrays.xml – 陣列資源。
– styles.xml – 樣式資源。
Dimens
 DPI (Dots Per Inch)
– The quantity of pixels within a physical area of the screen; usually
referred to as dpi (dots per inch).
Dimens
 PX, DPI and DP(DIP)
– Icon size = 160px
 MDPI -> 160px/160dpi = 1 inch
 XHDPI -> 160px/320dpi = 0.5 inch
– Icon size = 160dp -> px = dp * (dpi / 160 )
 MDPI -> px = 160 * ( 160dpi / 160dpi ) , px = 160
 XHDPI -> px = 160 * ( 320dpi / 160dpi) , px = 320
Dimens
 Suggestions
– Because it's important that you design and implement your layouts for
multiple densities, the guidelines below and throught the
documentation refer to layout dimensions with dp measurements
instead of pixels.
– Similarly, you should prefer the sp (scale-independent pixel) to define
text sizes. The sp scale factor depends on a user setting and the system
scales the size the same as it does for dp.
基本元件
 Activity
 Service
 BroadcastReceiver
 ContentProvider
控制項
 View class
– This class represents the basic
building block for user interface
components.
 ViewGroup class
– The ViewGroup subclass is the base
class for layouts, which are invisible
containers that hold other Views (or
other ViewGroups) and define their
layout properties.
控制項
 View class
– This class represents the basic
building block for user interface
components.
 ViewGroup class
– The ViewGroup subclass is the base
class for layouts, which are invisible
containers that hold other Views (or
other ViewGroups) and define their
layout properties.
TextView and EditText
 TextView
– Displays text to the user and
optionally allows them to edit
it.
 EditText
– EditText is a thin veneer over
TextView that configures itself
to be editable.
TextView and EditText
 TextView
– Displays text to the user and
optionally allows them to edit
it.
 EditText
– EditText is a thin veneer over
TextView that configures itself
to be editable.
LinearLayout
 android:orientation -
setOrientation(int)
– Should the layout be a column
or a row? Use "horizontal" for a
row, "vertical" for a column.
 android:gravity -
setGravity(int)
– Specifies how an object should
position its content, on both
the X and Y axes, within its own
bounds.
LinearLayout
 Practice
Horizontal Vertical & Horizontal
FrameLayout
 Practice
RelativeLayout
 android:layout_above, android:layout_below
– Positions the bottom edge of this view above or below the given anchor view ID.
 android:layout_alignParentBottom, android:layout_alignParentLeft,
android:layout_alignParentRight, android:layout_alignParentTop
– If true, makes the edge of this view match the edge you assign of the parent.
 android:layout_toLeftOf, android:layout_toRightOf
– Positions the right edge of this view to the left or right of the given anchor view
ID.
 android:layout_centerInParent
– If true, centers this child horizontally and vertically within its parent.
RelativeLayout
 Practice
Event Listeners
 Event Listeners
– An event listener is an interface in the View class that contains a single
callback method. These methods will be called by the Android
framework when the View to which the listener has been registered is
triggered by user interaction with the item in the UI.
– Included in the event listener interfaces are the following callback
methods:
 onClick()
 onTouch()
 onLongClick()
 onFocusChange()
 onKey()
Intent
 Android 中的 Intent 非常好用,整個
Android 的架構最大的特色可以說就建構
在 Intent 上,您可以利用類似 URL 的
Intent 啟動任何一個程式的任何一個畫面。
練習
 請依照開發「App的事前準備」章節的步驟,討論並設計一個資料查詢App。
討論項目如下,並上台解說:
– App的需求(至少三種功能性需求與資料來源為何)
– App介面
– 資源
 系統資源
 一般資源
– 控制項與Layout
– 實作技術,範例如下:
 Volley與Gson – 使用目的為何?
 資料庫 – 在何種頁面應用?
 演算法 - 何種情境或設計中使用 ?
作業
 請各組選擇以下的控制項的做為下週的簡報內容:
– TextView & EditView
– Button, ImageButton
– CheckBox & RadioButton
– ImageView & ScrollView
– ListView
作業
 簡報需涵蓋下列內容:
– 各成員的分工
– App結果顯示(模擬器展示或簡報截圖)
– 各頁面的Layout說明
– 程式架構
Sample Code and Slides
 Slides
– http://www.slideshare.net/XavierYin/tkuappandroid-55623527
 Sample Code
– https://github.com/xavier0507/TKUInforTableSampleCode
References
 CodeData:
– http://www.codedata.com.tw/mobile/android-6-tutorial-1-4/
– http://www.codedata.com.tw/mobile/android-6-tutorial-2-1/
 Android developers:
– http://developer.android.com/design/index.html
 陳鍾誠的網站
– http://ccckmit.wikidot.com/ga:intentexample

More Related Content

Viewers also liked

Viewers also liked (15)

Quản lý tổng hợp vùng bờ tỉnh sóc Trang
Quản lý tổng hợp vùng bờ tỉnh sóc TrangQuản lý tổng hợp vùng bờ tỉnh sóc Trang
Quản lý tổng hợp vùng bờ tỉnh sóc Trang
 
Material design introduction
Material design introductionMaterial design introduction
Material design introduction
 
Bob Shultz - Résumé FA
Bob Shultz - Résumé FABob Shultz - Résumé FA
Bob Shultz - Résumé FA
 
Chuong 2
Chuong 2Chuong 2
Chuong 2
 
Test automation
Test automationTest automation
Test automation
 
行動App開發管理實務unit3
行動App開發管理實務unit3行動App開發管理實務unit3
行動App開發管理實務unit3
 
Material design - widgets and sample code
Material design - widgets and sample codeMaterial design - widgets and sample code
Material design - widgets and sample code
 
Cecilia D Cobb Resume
Cecilia D Cobb ResumeCecilia D Cobb Resume
Cecilia D Cobb Resume
 
Chuong 1
Chuong 1Chuong 1
Chuong 1
 
Application for contract labour license
Application for contract labour licenseApplication for contract labour license
Application for contract labour license
 
Chuong 4
Chuong 4Chuong 4
Chuong 4
 
Chuong 8
Chuong  8Chuong  8
Chuong 8
 
Chuong 5
Chuong 5Chuong 5
Chuong 5
 
Chuong 7
Chuong 7Chuong 7
Chuong 7
 
機器學習與資料探勘:決策樹
機器學習與資料探勘:決策樹機器學習與資料探勘:決策樹
機器學習與資料探勘:決策樹
 

Similar to Tku-行動app開發管理實務-Android應用程式開發基礎

mobile application development -unit-3-
mobile application development  -unit-3-mobile application development  -unit-3-
mobile application development -unit-3-TejamFandat
 
Android training day 3
Android training day 3Android training day 3
Android training day 3Vivek Bhusal
 
Best Practices for Android UI by RapidValue Solutions
Best Practices for Android UI by RapidValue SolutionsBest Practices for Android UI by RapidValue Solutions
Best Practices for Android UI by RapidValue SolutionsRapidValue
 
Marakana Android User Interface
Marakana Android User InterfaceMarakana Android User Interface
Marakana Android User InterfaceMarko Gargenta
 
Android_Bootcamp_PPT_GDSC_ITS_Engineering
Android_Bootcamp_PPT_GDSC_ITS_EngineeringAndroid_Bootcamp_PPT_GDSC_ITS_Engineering
Android_Bootcamp_PPT_GDSC_ITS_EngineeringShivanshSeth6
 
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...Ted Chien
 
6. Chapter 5 - Component In React Navite.pptx
6. Chapter 5 - Component In React Navite.pptx6. Chapter 5 - Component In React Navite.pptx
6. Chapter 5 - Component In React Navite.pptxTngTrngKhnh1
 
Google Associate Android Developer Certification
Google Associate Android Developer CertificationGoogle Associate Android Developer Certification
Google Associate Android Developer CertificationMonir Zzaman
 
Deep Dive Xamarin.Android
Deep Dive Xamarin.AndroidDeep Dive Xamarin.Android
Deep Dive Xamarin.AndroidBenjamin Bishop
 
Fernando F. Gallego - Efficient Android Resources 101
Fernando F. Gallego - Efficient Android Resources 101Fernando F. Gallego - Efficient Android Resources 101
Fernando F. Gallego - Efficient Android Resources 101Fernando Gallego
 
Application Development - Overview on Android OS
Application Development - Overview on Android OSApplication Development - Overview on Android OS
Application Development - Overview on Android OSPankaj Maheshwari
 
"Android" mobilių programėlių kūrimo įvadas #2
"Android" mobilių programėlių kūrimo įvadas #2"Android" mobilių programėlių kūrimo įvadas #2
"Android" mobilių programėlių kūrimo įvadas #2Tadas Jurelevičius
 
Android Development - Session 4
Android Development - Session 4Android Development - Session 4
Android Development - Session 4Mohammad Shaker
 
Top Tips for Android UIs - Getting the Magic on Tablets
Top Tips for Android UIs - Getting the Magic on TabletsTop Tips for Android UIs - Getting the Magic on Tablets
Top Tips for Android UIs - Getting the Magic on TabletsMotorola Mobility - MOTODEV
 
WMP_MP02_revd_03(10092023).pptx
WMP_MP02_revd_03(10092023).pptxWMP_MP02_revd_03(10092023).pptx
WMP_MP02_revd_03(10092023).pptxfahmi324663
 
Java talks. Android intoduction for develompment
Java talks. Android intoduction for develompmentJava talks. Android intoduction for develompment
Java talks. Android intoduction for develompmentAlexei Miliutin
 
WMP_MP02_revd(10092023).pptx
WMP_MP02_revd(10092023).pptxWMP_MP02_revd(10092023).pptx
WMP_MP02_revd(10092023).pptxfahmi324663
 

Similar to Tku-行動app開發管理實務-Android應用程式開發基礎 (20)

mobile application development -unit-3-
mobile application development  -unit-3-mobile application development  -unit-3-
mobile application development -unit-3-
 
Android training day 3
Android training day 3Android training day 3
Android training day 3
 
Best Practices for Android UI by RapidValue Solutions
Best Practices for Android UI by RapidValue SolutionsBest Practices for Android UI by RapidValue Solutions
Best Practices for Android UI by RapidValue Solutions
 
Marakana Android User Interface
Marakana Android User InterfaceMarakana Android User Interface
Marakana Android User Interface
 
Android_Bootcamp_PPT_GDSC_ITS_Engineering
Android_Bootcamp_PPT_GDSC_ITS_EngineeringAndroid_Bootcamp_PPT_GDSC_ITS_Engineering
Android_Bootcamp_PPT_GDSC_ITS_Engineering
 
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
 
6. Chapter 5 - Component In React Navite.pptx
6. Chapter 5 - Component In React Navite.pptx6. Chapter 5 - Component In React Navite.pptx
6. Chapter 5 - Component In React Navite.pptx
 
Google Associate Android Developer Certification
Google Associate Android Developer CertificationGoogle Associate Android Developer Certification
Google Associate Android Developer Certification
 
Deep Dive Xamarin.Android
Deep Dive Xamarin.AndroidDeep Dive Xamarin.Android
Deep Dive Xamarin.Android
 
Fernando F. Gallego - Efficient Android Resources 101
Fernando F. Gallego - Efficient Android Resources 101Fernando F. Gallego - Efficient Android Resources 101
Fernando F. Gallego - Efficient Android Resources 101
 
Android ui with xml
Android ui with xmlAndroid ui with xml
Android ui with xml
 
Application Development - Overview on Android OS
Application Development - Overview on Android OSApplication Development - Overview on Android OS
Application Development - Overview on Android OS
 
"Android" mobilių programėlių kūrimo įvadas #2
"Android" mobilių programėlių kūrimo įvadas #2"Android" mobilių programėlių kūrimo įvadas #2
"Android" mobilių programėlių kūrimo įvadas #2
 
Android Development - Session 4
Android Development - Session 4Android Development - Session 4
Android Development - Session 4
 
Top Tips for Android UIs - Getting the Magic on Tablets
Top Tips for Android UIs - Getting the Magic on TabletsTop Tips for Android UIs - Getting the Magic on Tablets
Top Tips for Android UIs - Getting the Magic on Tablets
 
WMP_MP02_revd_03(10092023).pptx
WMP_MP02_revd_03(10092023).pptxWMP_MP02_revd_03(10092023).pptx
WMP_MP02_revd_03(10092023).pptx
 
Android_PDF
Android_PDFAndroid_PDF
Android_PDF
 
Chapter 5 - Layouts
Chapter 5 - LayoutsChapter 5 - Layouts
Chapter 5 - Layouts
 
Java talks. Android intoduction for develompment
Java talks. Android intoduction for develompmentJava talks. Android intoduction for develompment
Java talks. Android intoduction for develompment
 
WMP_MP02_revd(10092023).pptx
WMP_MP02_revd(10092023).pptxWMP_MP02_revd(10092023).pptx
WMP_MP02_revd(10092023).pptx
 

Recently uploaded

Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsPooky Knightsmith
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvRicaMaeCastro1
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptxmary850239
 

Recently uploaded (20)

Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young minds
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx
 

Tku-行動app開發管理實務-Android應用程式開發基礎

  • 2. Outline  開發App的事前準備  Project Structure  基本控制項  Intent  Events  Intent  練習  作業
  • 3. 事前準備  建立應用程式的基本資訊 – 決定開發版本 – 決定欲使用的Android設備 – 考量所需使用的硬體設備資訊 (AndroidManifest.xml)  應用程式的需求分析與規劃 – 功能需求 – 介面  應用程式的資源 – 文字或文案、顏色、尺寸、動畫、 圖片、畫面、樣式、音樂或影片、 檔案…等等。
  • 4. 事前準備  Android開發環境 – JDK  Download JDK (or from Oracle)  Installation and Environment Variable Settings – JAVA_HOME – PATH – Installation result on cmd – Android SDK and Studio  Download Android SDK and Studio (or from Android Developer)  Installation – Launch the .exe file you just downloaded – Follow the setup wizard
  • 5. 事前準備  撰寫應用程式  測試和安裝 – Real Devices – Emulator  AVD  Genymotion
  • 6. Project Structure  /app – /src  /main/java – /your_package_name (ex: /com/tku/android -> com.tku.android)  Java files – AndroidManifest.xml  /androidTest(For Android Test) – /java/your_package_name  Test cases  /res – /drawable – /layout – /values  colors.xml, dimens.xml, strings.xml, styles.xml…etc.  build.gradle
  • 7. App Manifest  Manifest file – The manifest file presents essential information about your app to the Android system, information the system must have before it can run any of the app's code.  Permission – A basic Android application has no permissions associated with it by default, meaning it cannot do anything that would adversely impact the user experience or any data on the device. – To make use of protected features of the device, you must include in your AndroidManifest.xml one or more <uses-permission> tags declaring the permissions that your application needs.
  • 9. Resources  系統資源 – android.R.anim – 系統動畫資源。 – android.R.color – 系統顏色狀態資源。 – android.R.dimen – 系統尺寸資源。 – android.R.drawable – 系統圖形與繪圖資源。 – android.R.layout – 系統畫面配置資源。 – android.R.menu – 系統選單資源。 – android.R.string – 系統文字資源。 – android.R.style – 系統樣式資源。  一般資源 – strings.xml – 文字資源。 – colors.xml – 顏色資源。 – dimens.xml – 尺寸資源。 – arrays.xml – 陣列資源。 – styles.xml – 樣式資源。
  • 10. Dimens  DPI (Dots Per Inch) – The quantity of pixels within a physical area of the screen; usually referred to as dpi (dots per inch).
  • 11. Dimens  PX, DPI and DP(DIP) – Icon size = 160px  MDPI -> 160px/160dpi = 1 inch  XHDPI -> 160px/320dpi = 0.5 inch – Icon size = 160dp -> px = dp * (dpi / 160 )  MDPI -> px = 160 * ( 160dpi / 160dpi ) , px = 160  XHDPI -> px = 160 * ( 320dpi / 160dpi) , px = 320
  • 12. Dimens  Suggestions – Because it's important that you design and implement your layouts for multiple densities, the guidelines below and throught the documentation refer to layout dimensions with dp measurements instead of pixels. – Similarly, you should prefer the sp (scale-independent pixel) to define text sizes. The sp scale factor depends on a user setting and the system scales the size the same as it does for dp.
  • 13. 基本元件  Activity  Service  BroadcastReceiver  ContentProvider
  • 14. 控制項  View class – This class represents the basic building block for user interface components.  ViewGroup class – The ViewGroup subclass is the base class for layouts, which are invisible containers that hold other Views (or other ViewGroups) and define their layout properties.
  • 15. 控制項  View class – This class represents the basic building block for user interface components.  ViewGroup class – The ViewGroup subclass is the base class for layouts, which are invisible containers that hold other Views (or other ViewGroups) and define their layout properties.
  • 16. TextView and EditText  TextView – Displays text to the user and optionally allows them to edit it.  EditText – EditText is a thin veneer over TextView that configures itself to be editable.
  • 17. TextView and EditText  TextView – Displays text to the user and optionally allows them to edit it.  EditText – EditText is a thin veneer over TextView that configures itself to be editable.
  • 18. LinearLayout  android:orientation - setOrientation(int) – Should the layout be a column or a row? Use "horizontal" for a row, "vertical" for a column.  android:gravity - setGravity(int) – Specifies how an object should position its content, on both the X and Y axes, within its own bounds.
  • 21. RelativeLayout  android:layout_above, android:layout_below – Positions the bottom edge of this view above or below the given anchor view ID.  android:layout_alignParentBottom, android:layout_alignParentLeft, android:layout_alignParentRight, android:layout_alignParentTop – If true, makes the edge of this view match the edge you assign of the parent.  android:layout_toLeftOf, android:layout_toRightOf – Positions the right edge of this view to the left or right of the given anchor view ID.  android:layout_centerInParent – If true, centers this child horizontally and vertically within its parent.
  • 23. Event Listeners  Event Listeners – An event listener is an interface in the View class that contains a single callback method. These methods will be called by the Android framework when the View to which the listener has been registered is triggered by user interaction with the item in the UI. – Included in the event listener interfaces are the following callback methods:  onClick()  onTouch()  onLongClick()  onFocusChange()  onKey()
  • 24. Intent  Android 中的 Intent 非常好用,整個 Android 的架構最大的特色可以說就建構 在 Intent 上,您可以利用類似 URL 的 Intent 啟動任何一個程式的任何一個畫面。
  • 25. 練習  請依照開發「App的事前準備」章節的步驟,討論並設計一個資料查詢App。 討論項目如下,並上台解說: – App的需求(至少三種功能性需求與資料來源為何) – App介面 – 資源  系統資源  一般資源 – 控制項與Layout – 實作技術,範例如下:  Volley與Gson – 使用目的為何?  資料庫 – 在何種頁面應用?  演算法 - 何種情境或設計中使用 ?
  • 26. 作業  請各組選擇以下的控制項的做為下週的簡報內容: – TextView & EditView – Button, ImageButton – CheckBox & RadioButton – ImageView & ScrollView – ListView
  • 27. 作業  簡報需涵蓋下列內容: – 各成員的分工 – App結果顯示(模擬器展示或簡報截圖) – 各頁面的Layout說明 – 程式架構
  • 28. Sample Code and Slides  Slides – http://www.slideshare.net/XavierYin/tkuappandroid-55623527  Sample Code – https://github.com/xavier0507/TKUInforTableSampleCode
  • 29. References  CodeData: – http://www.codedata.com.tw/mobile/android-6-tutorial-1-4/ – http://www.codedata.com.tw/mobile/android-6-tutorial-2-1/  Android developers: – http://developer.android.com/design/index.html  陳鍾誠的網站 – http://ccckmit.wikidot.com/ga:intentexample