SlideShare una empresa de Scribd logo
1 de 42
Descargar para leer sin conexión
Basic Programming
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Android applications development process
Day 1
Day 1 - 4
Day 5-6
Day 5-6
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
AndroidVersion
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Application Design
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
UI Overview
1. Main Action Bar (API 11)
2.View Control
3. Content Area
4. Split Action Bar (API 11)
5. Options Menu
5
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Fixed Tab SpinnerNavigation Drawers
Application Structure
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Fixed Tabs : Movies ,Twitter
Fixed Tabs
- ต้องการเน้นให้ผู้ใช้เห็นข้อมูลหน้าอื่น ๆ
- ใช้เมื่อต้องสลับหน้าจอ(View) บ่อย ๆ
- จํานวน Top LevelView ไม่ควรเกิน 3-5
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Scrollable Tabs : Google Play Store
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Stacked Tabs :You Tube
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Gmail
Holo Light
Setting
Holo Dark
Talk in
Holo Light with Dark
action bar
Theme (ice cream sandwich :API 15)
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Metrics and Grid
Button ~48dp
Gap ~8 dp
Size should be specified in dp (density-independent pixels ) do not use = px (pixel)
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Font
Font size should be sp (scale-independent pixels)
do not use = pt (point)
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
AndroidManifest.xml
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<activity
android:name="MainActivity"
android:label="@string/app_name"
android:configChanges = "orientation|keyboard">
<!-- android:screenOrientation ="portrait" -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-permission android:name="android.permission.INTERNET" />
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Styles and Themes
<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textColor="#00FF00"
    android:typeface="monospace"
    android:text="@string/hello" />
<TextView
    style="@style/CodeFont"
    android:text="@string/hello" />
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="CodeFont" parent="@android:style/TextAppearance.Medium">
        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textColor">#00FF00</item>
        <item name="android:typeface">monospace</item>
    </style>
</resources>
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
icon name
Asset Type Prefix Example
Icons ic_ ic_star.png
Launcher icons ic_launcher ic_launcher_calendar.png
Menu icons and Action Bar icons ic_menu ic_menu_archive.png
Status bar icons ic_stat_notify ic_stat_notify_msg.png
Tab icons ic_tab ic_tab_recent.png
Dialog icons ic_dialog ic_dialog_info.png
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Android Drawables (www.androiddrawables.com)
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Eclipse Shortcuts
Ctrl + Shift + Space : Show method parameter
Fn + Cmd + F11 : Run
Cmd + i : Correct Code Indentation
Rotate Device : Fn(F12) + Control
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Create Android Application
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Create Android Application : Step 1
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Create Android Application : Step 2
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Create Android Application : Step 3
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Create Android Application : Step 4
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Create Android Application : Step 5
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Activity
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Activity
Setting
Activity
Fullscreen
Activity
Login
Activity
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Create New Activity : Step 1
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Create New Activity : Step 2
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Create New Activity : Step 3
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Create New Activity : Step 4
Add 3 Blank Activity
- FirstActivity
- WebViewActivity
- DialogActivity
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Login Activity
Add New Login Activity
-LoginActivity.java
-activity_login.xml
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Settings Activity
Add New Settings Activity
-SettingsActivity.java
-activity_settings.xml
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Menu
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Menu
Options Menu
(< API 10)
Action Bar
(> API 11)
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Menu : edit main.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:showAsAction="always"
android:title="@string/action_settings"/>
<item
android:id="@+id/action_login"
android:orderInCategory="90"
android:showAsAction="ifRoom"
android:title="Login"/>
<item
android:id="@+id/action_about"
android:icon="@drawable/ic_launcher"
android:orderInCategory="91"
android:showAsAction="ifRoom"
android:title="About"/>
</menu>
android:showAsAction=["ifRoom" | "never" | "withText" | "always" | "collapseActionView"]
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Menu : Add Custom Menu : MainActivity.java
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
//add custom menu
menu.add("Save")
	 .setIcon(android.R.drawable.ic_menu_save)
	 .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
	 menu.add("Search")
	 .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
	 menu.add("Gallery")
	 .setIcon(android.R.drawable.ic_menu_gallery)
	 .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
	 return true;
}
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Menu : edit MainActivity.java
public boolean onOptionsItemSelected(MenuItem item) {
	 	 switch (item.getItemId()) {
	 	 case R.id.action_settings:
	 	 	 startActivity(new Intent(this, SettingsActivity.class));
	 	 	 return true;
	 	 case R.id.action_login:
	 	 	 startActivity(new Intent(this, LoginActivity.class));
	 	 	 return true;
	 	 case R.id.action_about:
	 	 	 startActivity(new Intent(this, WebViewActivity.class));
	 	 	 return true;
	 	 default:
	 	 	 return super.onOptionsItemSelected(item);
	 	 }
	 }
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Menus
Floating context menu Contextual action bar Checkable menu Popup Menu
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
WebView
Add New Blank Activity
-WebViewActivity.java
-activity_webview.xml
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Progress Bar
Progress bars
Activity bar
progressBarStyleHorizontal progressBarStyleLarge
progressBarStyle
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
Add Permission :AndroidManifest.xml
WebView : activity_webview.xml
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true" />
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
style="?android:attr/progressBarStyle"
style="?android:attr/progressBarStyleSmall"
style="?android:attr/progressBarStyleLarge"
style="?android:attr/progressBarStyleHorizontal"
<uses-permission android:name="android.permission.INTERNET"/>
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
WebView : WebViewActivity.java
String urlString = "http://www.ibluecode.com" ;
WebView webView = (WebView) findViewById(R.id.webView1);
webView.loadUrl(urlString);
WebSettings webSettings = webView.getSettings();
	 webSettings.setJavaScriptEnabled(true);
final ProgressBar progressBar = (ProgressBar)findViewById(R.id.progressBar1);
	 webView.setWebViewClient(new WebViewClient(){
	 @Override
	 public void onPageStarted(WebView view, String url, Bitmap favicon) {
	 	 progressBar.setProgress(0);
	 	 progressBar.setVisibility(View.VISIBLE);
	 }
	 @Override
	 public void onPageFinished(WebView view, String url) {
	 	 progressBar.setProgress(100);
	 	 progressBar.setVisibility(View.GONE);
	 }
	 @Override
	 public boolean shouldOverrideUrlLoading(WebView view, String url) {
	 	 view.loadUrl(url);
	 	 return true;
	 }
});
}
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13
WebView : WebViewActivity.java
String urlString = "http://www.ibluecode.com" ;
//
Intent intent = getIntent();
if( intent.getExtras() != null)
{
	 urlString = intent.getExtras().get("url").toString() ;
}
//
WebView webView = (WebView) findViewById(R.id.webView1);
webView.loadUrl(urlString);
WebSettings webSettings = webView.getSettings();
	 webSettings.setJavaScriptEnabled(true);
final ProgressBar progressBar = (ProgressBar)findViewById(R.id.progressBar1);
	 webView.setWebViewClient(new WebViewClient(){
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
	 progressBar.setProgress(0);
	 progressBar.setVisibility(View.VISIBLE);
	 }
	 @Override
	 public void onPageFinished(WebView view, String url) {
	 	 progressBar.setProgress(100);
	 	 progressBar.setVisibility(View.GONE);
	 }
	 @Override
	 public boolean shouldOverrideUrlLoading(WebView view, String url) {
	 	 view.loadUrl(url);
	 	 return true;
	 }
});
}
Get Data from Intent
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Monday, May 27, 13

Más contenido relacionado

Destacado

Android application development
Android application developmentAndroid application development
Android application development
slidesuren
 
Android Programming Basic
Android Programming BasicAndroid Programming Basic
Android Programming Basic
Duy Do Phan
 
Fundamentals of information technology
Fundamentals       of          information   technologyFundamentals       of          information   technology
Fundamentals of information technology
haider ali
 

Destacado (20)

Android application development
Android application developmentAndroid application development
Android application development
 
basics of c++
basics of c++basics of c++
basics of c++
 
Android Programming Basic
Android Programming BasicAndroid Programming Basic
Android Programming Basic
 
Leveraging Android for the Internet of Things with Eclipse M2M
Leveraging Android for the Internet of Things with Eclipse M2MLeveraging Android for the Internet of Things with Eclipse M2M
Leveraging Android for the Internet of Things with Eclipse M2M
 
Fundamentals of information technology
Fundamentals       of          information   technologyFundamentals       of          information   technology
Fundamentals of information technology
 
Android App Development Intro at ESC SV 2012
Android App Development Intro at ESC SV 2012Android App Development Intro at ESC SV 2012
Android App Development Intro at ESC SV 2012
 
Android Sliding Menu dengan Navigation Drawer
Android Sliding Menu dengan Navigation DrawerAndroid Sliding Menu dengan Navigation Drawer
Android Sliding Menu dengan Navigation Drawer
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Advertising on the mobile phone
Advertising on the mobile phoneAdvertising on the mobile phone
Advertising on the mobile phone
 
Introduction to Android App Development
Introduction to Android App DevelopmentIntroduction to Android App Development
Introduction to Android App Development
 
Kenalan Dengan Firebase Android
Kenalan Dengan Firebase AndroidKenalan Dengan Firebase Android
Kenalan Dengan Firebase Android
 
Introduction to Android Development: Before Getting Started
Introduction to Android Development: Before Getting StartedIntroduction to Android Development: Before Getting Started
Introduction to Android Development: Before Getting Started
 
Android development basic _ZuoSyuanWang
Android development basic _ZuoSyuanWangAndroid development basic _ZuoSyuanWang
Android development basic _ZuoSyuanWang
 
Penting nya Toko online Bagi UKM (usaha kecil menengah)
Penting nya Toko online Bagi UKM (usaha kecil menengah)Penting nya Toko online Bagi UKM (usaha kecil menengah)
Penting nya Toko online Bagi UKM (usaha kecil menengah)
 
Android development - the basics, MFF UK, 2014
Android development - the basics, MFF UK, 2014Android development - the basics, MFF UK, 2014
Android development - the basics, MFF UK, 2014
 
Android Fast Track CRUD Android PHP MySql
Android Fast Track CRUD Android PHP MySqlAndroid Fast Track CRUD Android PHP MySql
Android Fast Track CRUD Android PHP MySql
 
Belajar Android PHP MySQL Login dengan Volley
Belajar Android PHP MySQL Login dengan VolleyBelajar Android PHP MySQL Login dengan Volley
Belajar Android PHP MySQL Login dengan Volley
 
LiFi Technology - Unfolding Future
LiFi Technology - Unfolding FutureLiFi Technology - Unfolding Future
LiFi Technology - Unfolding Future
 
手機自動化測試和持續整合
手機自動化測試和持續整合手機自動化測試和持續整合
手機自動化測試和持續整合
 
Belajar Android Membuat Katalog Produk
Belajar Android Membuat Katalog ProdukBelajar Android Membuat Katalog Produk
Belajar Android Membuat Katalog Produk
 

Similar a Android Basic Development Day 1 Introduction & ADT

(31 July 2013) iOS Basic Development Day 2 Human interface design
(31 July 2013) iOS Basic Development Day 2 Human interface design (31 July 2013) iOS Basic Development Day 2 Human interface design
(31 July 2013) iOS Basic Development Day 2 Human interface design
Eakapong Kattiya
 
HotPush with Ionic 2 and CodePush
HotPush with Ionic 2 and CodePushHotPush with Ionic 2 and CodePush
HotPush with Ionic 2 and CodePush
Evan Schultz
 
Designing and implementing_android_uis_for_phones_and_tablets
Designing and implementing_android_uis_for_phones_and_tabletsDesigning and implementing_android_uis_for_phones_and_tablets
Designing and implementing_android_uis_for_phones_and_tablets
Cường Doãn
 

Similar a Android Basic Development Day 1 Introduction & ADT (20)

(31 July 2013) iOS Basic Development Day 2 Human interface design
(31 July 2013) iOS Basic Development Day 2 Human interface design (31 July 2013) iOS Basic Development Day 2 Human interface design
(31 July 2013) iOS Basic Development Day 2 Human interface design
 
Gradle for Android Developers
Gradle for Android DevelopersGradle for Android Developers
Gradle for Android Developers
 
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...
 
Learn How to Animate your Android App
Learn How to Animate your Android AppLearn How to Animate your Android App
Learn How to Animate your Android App
 
HotPush with Ionic 2 and CodePush
HotPush with Ionic 2 and CodePushHotPush with Ionic 2 and CodePush
HotPush with Ionic 2 and CodePush
 
jQuery Mobile
jQuery MobilejQuery Mobile
jQuery Mobile
 
Google analytics
Google analyticsGoogle analytics
Google analytics
 
Primefaces mobile users_guide_0_9
Primefaces mobile users_guide_0_9Primefaces mobile users_guide_0_9
Primefaces mobile users_guide_0_9
 
React django
React djangoReact django
React django
 
iWebkit
iWebkitiWebkit
iWebkit
 
I/O Rewind 215: What's new in Android
I/O Rewind 215: What's new in AndroidI/O Rewind 215: What's new in Android
I/O Rewind 215: What's new in Android
 
Android workshop - 02. Glass development 101
Android workshop - 02. Glass development 101Android workshop - 02. Glass development 101
Android workshop - 02. Glass development 101
 
ChocolateChip-UI
ChocolateChip-UIChocolateChip-UI
ChocolateChip-UI
 
Invading the home screen
Invading the home screenInvading the home screen
Invading the home screen
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?
 
Ionic bbl le 19 février 2015
Ionic bbl le 19 février 2015Ionic bbl le 19 février 2015
Ionic bbl le 19 février 2015
 
Designing and implementing_android_uis_for_phones_and_tablets
Designing and implementing_android_uis_for_phones_and_tabletsDesigning and implementing_android_uis_for_phones_and_tablets
Designing and implementing_android_uis_for_phones_and_tablets
 
Android
AndroidAndroid
Android
 
Lecture #3 activities and intents
Lecture #3  activities and intentsLecture #3  activities and intents
Lecture #3 activities and intents
 
What's new in Android at I/O'16
What's new in Android at I/O'16What's new in Android at I/O'16
What's new in Android at I/O'16
 

Más de Eakapong Kattiya (9)

Android basic 4 Navigation Drawer
Android basic 4 Navigation DrawerAndroid basic 4 Navigation Drawer
Android basic 4 Navigation Drawer
 
Android basic 2 UI Design
Android basic 2 UI DesignAndroid basic 2 UI Design
Android basic 2 UI Design
 
Android basic 3 Dialogs
Android basic 3 DialogsAndroid basic 3 Dialogs
Android basic 3 Dialogs
 
Evrdi : Social Diary ( iOS and Android )
Evrdi : Social Diary ( iOS and Android )Evrdi : Social Diary ( iOS and Android )
Evrdi : Social Diary ( iOS and Android )
 
iOS Basic Development Day 2 - Objective-C 2.0 & iOS Framework
iOS Basic Development Day 2 - Objective-C 2.0 & iOS Framework iOS Basic Development Day 2 - Objective-C 2.0 & iOS Framework
iOS Basic Development Day 2 - Objective-C 2.0 & iOS Framework
 
(1 July 2013) iOS Basic Development Day 5 - Submit to App Store
(1 July 2013) iOS Basic Development Day 5 - Submit to App Store(1 July 2013) iOS Basic Development Day 5 - Submit to App Store
(1 July 2013) iOS Basic Development Day 5 - Submit to App Store
 
Iphone developer advance twitter
Iphone developer advance   twitterIphone developer advance   twitter
Iphone developer advance twitter
 
iOS Advance Development - Social Media
iOS Advance Development - Social MediaiOS Advance Development - Social Media
iOS Advance Development - Social Media
 
Iphone developer advance location based
Iphone developer advance location basedIphone developer advance location based
Iphone developer advance location based
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Último (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Android Basic Development Day 1 Introduction & ADT

  • 1. Basic Programming by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 2. Android applications development process Day 1 Day 1 - 4 Day 5-6 Day 5-6 by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 3. AndroidVersion by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 4. Application Design by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 5. UI Overview 1. Main Action Bar (API 11) 2.View Control 3. Content Area 4. Split Action Bar (API 11) 5. Options Menu 5 by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 6. Fixed Tab SpinnerNavigation Drawers Application Structure by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 7. Fixed Tabs : Movies ,Twitter Fixed Tabs - ต้องการเน้นให้ผู้ใช้เห็นข้อมูลหน้าอื่น ๆ - ใช้เมื่อต้องสลับหน้าจอ(View) บ่อย ๆ - จํานวน Top LevelView ไม่ควรเกิน 3-5 by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 8. Scrollable Tabs : Google Play Store by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 9. Stacked Tabs :You Tube by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 10. Gmail Holo Light Setting Holo Dark Talk in Holo Light with Dark action bar Theme (ice cream sandwich :API 15) by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 11. Metrics and Grid Button ~48dp Gap ~8 dp Size should be specified in dp (density-independent pixels ) do not use = px (pixel) by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 12. Font Font size should be sp (scale-independent pixels) do not use = pt (point) by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 13. AndroidManifest.xml <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="17" /> <activity android:name="MainActivity" android:label="@string/app_name" android:configChanges = "orientation|keyboard"> <!-- android:screenOrientation ="portrait" --> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <uses-permission android:name="android.permission.INTERNET" /> by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 14. Styles and Themes <TextView     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:textColor="#00FF00"     android:typeface="monospace"     android:text="@string/hello" /> <TextView     style="@style/CodeFont"     android:text="@string/hello" /> <?xml version="1.0" encoding="utf-8"?> <resources>     <style name="CodeFont" parent="@android:style/TextAppearance.Medium">         <item name="android:layout_width">fill_parent</item>         <item name="android:layout_height">wrap_content</item>         <item name="android:textColor">#00FF00</item>         <item name="android:typeface">monospace</item>     </style> </resources> by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 15. icon name Asset Type Prefix Example Icons ic_ ic_star.png Launcher icons ic_launcher ic_launcher_calendar.png Menu icons and Action Bar icons ic_menu ic_menu_archive.png Status bar icons ic_stat_notify ic_stat_notify_msg.png Tab icons ic_tab ic_tab_recent.png Dialog icons ic_dialog ic_dialog_info.png by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 16. Android Drawables (www.androiddrawables.com) by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 17. Eclipse Shortcuts Ctrl + Shift + Space : Show method parameter Fn + Cmd + F11 : Run Cmd + i : Correct Code Indentation Rotate Device : Fn(F12) + Control by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 18. Create Android Application by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 19. Create Android Application : Step 1 by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 20. Create Android Application : Step 2 by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 21. Create Android Application : Step 3 by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 22. Create Android Application : Step 4 by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 23. Create Android Application : Step 5 by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 24. Activity by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 25. Activity Setting Activity Fullscreen Activity Login Activity by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 26. Create New Activity : Step 1 by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 27. Create New Activity : Step 2 by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 28. Create New Activity : Step 3 by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 29. Create New Activity : Step 4 Add 3 Blank Activity - FirstActivity - WebViewActivity - DialogActivity by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 30. Login Activity Add New Login Activity -LoginActivity.java -activity_login.xml by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 31. Settings Activity Add New Settings Activity -SettingsActivity.java -activity_settings.xml by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 32. Menu by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 33. Menu Options Menu (< API 10) Action Bar (> API 11) by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 34. Menu : edit main.xml <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/action_settings" android:orderInCategory="100" android:showAsAction="always" android:title="@string/action_settings"/> <item android:id="@+id/action_login" android:orderInCategory="90" android:showAsAction="ifRoom" android:title="Login"/> <item android:id="@+id/action_about" android:icon="@drawable/ic_launcher" android:orderInCategory="91" android:showAsAction="ifRoom" android:title="About"/> </menu> android:showAsAction=["ifRoom" | "never" | "withText" | "always" | "collapseActionView"] by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 35. Menu : Add Custom Menu : MainActivity.java @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); //add custom menu menu.add("Save") .setIcon(android.R.drawable.ic_menu_save) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add("Search") .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); menu.add("Gallery") .setIcon(android.R.drawable.ic_menu_gallery) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true; } by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 36. Menu : edit MainActivity.java public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_settings: startActivity(new Intent(this, SettingsActivity.class)); return true; case R.id.action_login: startActivity(new Intent(this, LoginActivity.class)); return true; case R.id.action_about: startActivity(new Intent(this, WebViewActivity.class)); return true; default: return super.onOptionsItemSelected(item); } } by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 37. Menus Floating context menu Contextual action bar Checkable menu Popup Menu by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 38. WebView Add New Blank Activity -WebViewActivity.java -activity_webview.xml by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 39. Progress Bar Progress bars Activity bar progressBarStyleHorizontal progressBarStyleLarge progressBarStyle by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 40. Add Permission :AndroidManifest.xml WebView : activity_webview.xml <WebView android:id="@+id/webView1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentLeft="true" android:layout_centerVertical="true" /> <ProgressBar android:id="@+id/progressBar1" style="?android:attr/progressBarStyleLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true"/> style="?android:attr/progressBarStyle" style="?android:attr/progressBarStyleSmall" style="?android:attr/progressBarStyleLarge" style="?android:attr/progressBarStyleHorizontal" <uses-permission android:name="android.permission.INTERNET"/> by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 41. WebView : WebViewActivity.java String urlString = "http://www.ibluecode.com" ; WebView webView = (WebView) findViewById(R.id.webView1); webView.loadUrl(urlString); WebSettings webSettings = webView.getSettings(); webSettings.setJavaScriptEnabled(true); final ProgressBar progressBar = (ProgressBar)findViewById(R.id.progressBar1); webView.setWebViewClient(new WebViewClient(){ @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { progressBar.setProgress(0); progressBar.setVisibility(View.VISIBLE); } @Override public void onPageFinished(WebView view, String url) { progressBar.setProgress(100); progressBar.setVisibility(View.GONE); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }); } by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13
  • 42. WebView : WebViewActivity.java String urlString = "http://www.ibluecode.com" ; // Intent intent = getIntent(); if( intent.getExtras() != null) { urlString = intent.getExtras().get("url").toString() ; } // WebView webView = (WebView) findViewById(R.id.webView1); webView.loadUrl(urlString); WebSettings webSettings = webView.getSettings(); webSettings.setJavaScriptEnabled(true); final ProgressBar progressBar = (ProgressBar)findViewById(R.id.progressBar1); webView.setWebViewClient(new WebViewClient(){ @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { progressBar.setProgress(0); progressBar.setVisibility(View.VISIBLE); } @Override public void onPageFinished(WebView view, String url) { progressBar.setProgress(100); progressBar.setVisibility(View.GONE); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }); } Get Data from Intent by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Monday, May 27, 13