SlideShare una empresa de Scribd logo
1 de 39
Descargar para leer sin conexión
Android Dev Tips
Kanda Runapongsa Saikaew
Agenda
1. 
2. 
3. 
4. 
5. 

Love Relative Layout
Use Hierarchy Viewer
Use Eclipse Effectively
Use LogCat
Publish Application
1. Love Relative Layout
•  Most of the tutorials use LinearLayout, but you will find
• 
• 

that RelativeLayout is truly useful
A common example is the abuse of LinearLayout, which
leads to a proliferation of views in the view hierarchy
Every view, or worse every layout manager, you add to
your application comes at a cost: initialization, layout
and drawing become slower
Use LinearLayout
Use RelativeLayout
2. Use Hierarchy Viewer
•  The Android SDK tools include a tool called Hierarchy
Viewer that allows you to analyze your layout while your
application is running
•  Hierarchy Viewer works by allowing you to select running
processes on a connected device or emulator, then display
the layout tree
•  The traffic lights on each block represent its Measure,
Layout and Draw performance, helping you identify potential
issues.
Using HierarchyViewer
• 
• 

The hierarchyviewer tool is available in <sdk>/tools/
When opened, the Hierarchy Viewer shows a list of
available devices and its running components
Using Hierarchy Viewer
•  Click Load View Hierarchy to view the
layout hierarchy of the selected component
Using Hierarchy Viewer
-  A small bitmap image on the left
-  Two stacked items of text on the right
Using LinearLayout
Using LinearLayout
•  There is a 3-level hierarchy with some
problems laying out the text items
•  The timings for rendering a complete list
item using this layout are
• 
• 
• 

Measure: 0.977ms
Layout: 0.167ms
Draw: 2.717ms
Using RelativeLayout
Using RelativeLayout
• 

Because the layout performance above slows down due to
a nested LinearLayout
•  The performance might improve by flattening the layout—
make the layout shallow and wide, rather than narrow and
deep
•  Now rendering a list item takes
•  Measure: 0.598ms
•  Layout: 0.110ms
•  Draw: 2.146ms
3. Use Eclipse Effectively

• 
• 
• 

You should try to keep your hands on
keyboard
The less you touch the mouse, the more
code you can write
I am trying to keep the mouse laying still and
control the IDE completely using keyboard.
Eclipse Short Cut Keys
• 
• 
• 
• 
• 

Ctrl + D
Ctrl + 1
Ctrl + Shift + O
Ctrl + Shift + F
Ctrl + Shift + L

Delete row
Activates the quick fix
Organize imports
Format codes
Shows you a list of your
currently defined
shortcut keys
4. Use LogCat
•  It can be difficult in Android to figure out

• 

“what went wrong”.
LogCat will show cause of the problems.
o 
o 

Error message with red string.
Problems that cause by …. (something) with line of
that code.
How to Use LogCat
•  To use LogCat, first import android.util.Log
into your project
•  Now you can call the static class Log from
your project to start logging
•  Logcat has different levels of logging
Different Levels of Logging
V — Verbose (lowest priority)
D — Debug
I — Info
W — Warning
E — Error
F — Fatal
S — Silent (highest priority, on which nothing is ever
printed)
Setting Different Colors for Different Levels

•  Go to Preferences > LogCat > Colors
Example of Using Log Class
How to View LogCat
• 
• 
• 

Open LogCat view by clicking the LogCat icon at the
bottom right corner (1 in the figure)
Filter LogCat level (2 in the figure)
Search for some keyword (3 in the figure)
5. Publish Application
•  Prepare the application for release
•  Release the application to users
Configure Your Application for Release

•  Choose a good package
• 

The package name cannot start with com.example

•  Turn off logging and debugging
• 
• 
• 

Remove Log calls
Remove android:debuggable attribute from your
manifest file
Remove all Debug tracing calls such as
startMethodTracing()
Configure Your Application for Release
•  Clean up your directory
• 

Review the contents of your jni/, lib/, and src/ directories
•  The jni/ directory should contain only source files
associated with the Android NDK, such as .c, .cpp, .h,
and .mk files
•  The lib/ directory should contain only third-party library
files or private library files, including prebuilt shared and
static libraries
•  The src/ directory should not contain any .jar files.
Configure Your Application for Release
•  Review and update your manifest settings
•  <uses-permission> element
•  You should specify only those permissions that are
relevant and required for application
•  android:icon and android:label attributes
•  You must specify values for these attributes, which are
located in the <application> element
•  android:versionCode and android:versionName attributes.
•  We recommend that you specify values for these
attributes
Configure Your Application for Release
• 

Address compatibility issues
• 
• 

Add support for multiple screen configurations.
Optimize your application for Android tablet devices.
•  If your application is designed for devices older than
Android 3.0, make it compatible with Android 3.0 devices

• 

Consider using the Support Library.
• 
If your application is designed for devices running Android 3.x,
make your application compatible with older versions of Android
Support Different Devices
•  Support different languages
•  Support different screens
•  Different layouts
•  Different bitmaps
•  Different text sizes
Support Different Languages
• 
• 

Create the resource subdirectories and string resource
files
Example

MyProject/
res/
values/
strings.xml
values-es/
strings.xml
Support Different Languages
English (default locale), /values/strings.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="title">My Application</string>
<string name="hello_world">Hello World!</string>
</resources>
Spanish, /values-es/strings.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="title">Mi Aplicación</string>
<string name="hello_world">Hola Mundo!</string>
</resources>
Support Different Screens
•  Android categorizes device screens using two
general properties: size and density
•  There are four generalized sizes: small,
normal, large, xlarge
•  Four generalized densities: low (ldpi), medium
(mdpi), high (hdpi), extra high (xhdpi)
Support Different Layouts
MyProject/
res/
layout/
main.xml

# default (portrait)

layout-land/

# landscape

main.xml
layout-large/

# large (portrait)

main.xml
layout-large-land/ # large landscape
main.xml
Support Different Bitmaps
•  To generate these images, you should start with your raw resource
in vector format and generate the images for each density using
the following size scale:
• 
• 

xhdpi: 2.0
hdpi: 1.5

• 
• 

mdpi: 1.0 (baseline)
ldpi: 0.75

•  This means that if you generate a 200x200 image for xhdpi
devices, you should generate the same resource in 150x150 for
hdpi, 100x100 for mdpi, and 75x75 for ldpi devices.
Support Different Bitmaps
Then, place the files in the appropriate drawable resource directory:
MyProject/
res/
drawable-xhdpi/
awesomeimage.png
drawable-hdpi/
awesomeimage.png
drawable-mdpi/
awesomeimage.png
Any time you reference @drawable/awesomeimage, the system selects the
appropriate bitmap based on the screen's density.
Support Different Text Sizes
• 

You should use the resource folders such as

values-ldpi
values-mdpi
values-hdpi
• 

Write the text size in 'dimensions.xml' file for each range

Sample dimensions.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="textsize">15sp</dimen>
</resources>
• 

In Java code, textView.setTextSize(getResources().getDimension(R.dimen.textsize));
What to Test
•  Change in orientation
• 
• 

Is the screen re-drawn correctly?
Does the application maintain its state?

•  Change in configuration
• 

A situation that is more general than a change in
orientation is a change in the device's configuration,
such as a change in the availability of a keyboard or
a change in system language
What to Test
•  Battery Life
• 

• 

You need to write your application to minimize
battery usage, you need to test its battery
performance, and you need to test the methods that
manage battery usage.
Techniques for minimizing battery usage were
presented at the 2010 Google I/O conference in the
presentation Coding for Life -- Battery Life, That Is.
What to Test
•  Dependence on external resources
•  If your application depends on network access,
SMS, Bluetooth, or GPS, then you should test what
happens when the resource or resources are not
available
•  For example, if your application uses the network, it
can notify the user if access is unavailable, or
disable network-related features, or do both
References
• 
• 
• 
• 
• 
• 
• 
• 
• 

http://stackoverflow.com/questions/2961049/effective-android-programmingtechniques
http://www.curious-creature.org/2009/02/22/android-layout-tricks-1/
http://www.curious-creature.org/2012/12/01/android-performance-case-study/
http://developer.android.com/training/improving-layouts/optimizing-layout.html
http://eclipse.dzone.com/news/effective-eclipse-shortcut-key
http://developer.android.com/tools/testing/what_to_test.html
http://developer.android.com/tools/publishing/preparing.html
http://stackoverflow.com/questions/9494037/how-to-set-text-size-of-textviewdynamically-for-diffrent-screens
http://developer.android.com/training/basics/supporting-devices/screens.html
Thank you
Kanda Runapongsa Saikaew
•  Khon Kaen University, Thailand
• 
• 

• 
• 
• 

Assistant Professor of Department of Computer Engineering
Associate Director for Administration of Computer Center

krunapon@kku.ac.th
Twitter: @krunapon
G+: https://plus.google.com/u/0/118244887738724224199

Más contenido relacionado

La actualidad más candente

Building a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web ServicesBuilding a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web ServicesDavid Giard
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for JavaLars Vogel
 
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...Naga Rohit
 
Angular 4 for Java Developers
Angular 4 for Java DevelopersAngular 4 for Java Developers
Angular 4 for Java DevelopersYakov Fain
 
Developing Java Web Applications In Google App Engine
Developing Java Web Applications In Google App EngineDeveloping Java Web Applications In Google App Engine
Developing Java Web Applications In Google App EngineTahir Akram
 
Urban Airship & Android Application Integration Document
Urban Airship & Android Application Integration DocumentUrban Airship & Android Application Integration Document
Urban Airship & Android Application Integration Documentmobi fly
 
Urban Airship and Android Integration for Push Notification and In-App Notifi...
Urban Airship and Android Integration for Push Notification and In-App Notifi...Urban Airship and Android Integration for Push Notification and In-App Notifi...
Urban Airship and Android Integration for Push Notification and In-App Notifi...Zeeshan Rahman
 
Salesforce Lightning Tips & Tricks
Salesforce Lightning Tips & Tricks Salesforce Lightning Tips & Tricks
Salesforce Lightning Tips & Tricks Thinqloud
 
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch TutorialMongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch TutorialMongoDB
 
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...Kobkrit Viriyayudhakorn
 
Introduction to angular with a simple but complete project
Introduction to angular with a simple but complete projectIntroduction to angular with a simple but complete project
Introduction to angular with a simple but complete projectJadson Santos
 
AppSyncをReactで使ってみた
AppSyncをReactで使ってみたAppSyncをReactで使ってみた
AppSyncをReactで使ってみたTakahiro Kobaru
 
Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20
Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20
Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20CodeValue
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React NativeRami Sayar
 
Developing Android Client Apps via SyncAdapter
Developing Android Client Apps via SyncAdapterDeveloping Android Client Apps via SyncAdapter
Developing Android Client Apps via SyncAdapterAnatoliy Kaverin
 

La actualidad más candente (20)

Building a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web ServicesBuilding a TV show with Angular, Bootstrap, and Web Services
Building a TV show with Angular, Bootstrap, and Web Services
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
 
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...
Introduction to Google App Engine - Naga Rohit S [ IIT Guwahati ] - Google De...
 
Google cloud endpoints
Google cloud endpointsGoogle cloud endpoints
Google cloud endpoints
 
Angular 4 for Java Developers
Angular 4 for Java DevelopersAngular 4 for Java Developers
Angular 4 for Java Developers
 
Developing Java Web Applications In Google App Engine
Developing Java Web Applications In Google App EngineDeveloping Java Web Applications In Google App Engine
Developing Java Web Applications In Google App Engine
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 
Urban Airship & Android Application Integration Document
Urban Airship & Android Application Integration DocumentUrban Airship & Android Application Integration Document
Urban Airship & Android Application Integration Document
 
Urban Airship and Android Integration for Push Notification and In-App Notifi...
Urban Airship and Android Integration for Push Notification and In-App Notifi...Urban Airship and Android Integration for Push Notification and In-App Notifi...
Urban Airship and Android Integration for Push Notification and In-App Notifi...
 
Ajax
AjaxAjax
Ajax
 
Salesforce Lightning Tips & Tricks
Salesforce Lightning Tips & Tricks Salesforce Lightning Tips & Tricks
Salesforce Lightning Tips & Tricks
 
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch TutorialMongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
 
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...
 
Introduction to angular with a simple but complete project
Introduction to angular with a simple but complete projectIntroduction to angular with a simple but complete project
Introduction to angular with a simple but complete project
 
AppSyncをReactで使ってみた
AppSyncをReactで使ってみたAppSyncをReactで使ってみた
AppSyncをReactで使ってみた
 
Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20
Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20
Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 
Meteor.js for DOers
Meteor.js for DOersMeteor.js for DOers
Meteor.js for DOers
 
Developing Android Client Apps via SyncAdapter
Developing Android Client Apps via SyncAdapterDeveloping Android Client Apps via SyncAdapter
Developing Android Client Apps via SyncAdapter
 

Destacado

Mobile Dev Talk #0 Keynote & Mobile Trend 2015
Mobile Dev Talk #0 Keynote & Mobile Trend 2015Mobile Dev Talk #0 Keynote & Mobile Trend 2015
Mobile Dev Talk #0 Keynote & Mobile Trend 2015Sittiphol Phanvilai
 
Android dev toolbox
Android dev toolboxAndroid dev toolbox
Android dev toolboxShem Magnezi
 
Andriod dev toolbox part 2
Andriod dev toolbox  part 2Andriod dev toolbox  part 2
Andriod dev toolbox part 2Shem Magnezi
 
Android ui tips & tricks
Android ui tips & tricksAndroid ui tips & tricks
Android ui tips & tricksShem Magnezi
 
Know what (not) to build
Know what (not) to buildKnow what (not) to build
Know what (not) to buildShem Magnezi
 
Summit 2015: Mobile App Dev and Content Management with Adobe Experience Manager
Summit 2015: Mobile App Dev and Content Management with Adobe Experience ManagerSummit 2015: Mobile App Dev and Content Management with Adobe Experience Manager
Summit 2015: Mobile App Dev and Content Management with Adobe Experience Managerbrucelefebvre
 
Tracxn Research — Mobile Dev Tools Landscape, November 2016
Tracxn Research — Mobile Dev Tools Landscape, November 2016Tracxn Research — Mobile Dev Tools Landscape, November 2016
Tracxn Research — Mobile Dev Tools Landscape, November 2016Tracxn
 
Android Dev Tools Knowledge
Android Dev Tools KnowledgeAndroid Dev Tools Knowledge
Android Dev Tools KnowledgeShinobu Okano
 
2nd Athens Android Dev Meetup: Hello Android, from zero to hello
2nd Athens Android Dev Meetup: Hello Android, from zero to hello2nd Athens Android Dev Meetup: Hello Android, from zero to hello
2nd Athens Android Dev Meetup: Hello Android, from zero to helloMando Stam
 

Destacado (11)

Mobile Dev Talk #0 Keynote & Mobile Trend 2015
Mobile Dev Talk #0 Keynote & Mobile Trend 2015Mobile Dev Talk #0 Keynote & Mobile Trend 2015
Mobile Dev Talk #0 Keynote & Mobile Trend 2015
 
Android dev toolbox
Android dev toolboxAndroid dev toolbox
Android dev toolbox
 
Andriod dev toolbox part 2
Andriod dev toolbox  part 2Andriod dev toolbox  part 2
Andriod dev toolbox part 2
 
Android ui tips & tricks
Android ui tips & tricksAndroid ui tips & tricks
Android ui tips & tricks
 
Know what (not) to build
Know what (not) to buildKnow what (not) to build
Know what (not) to build
 
Summit 2015: Mobile App Dev and Content Management with Adobe Experience Manager
Summit 2015: Mobile App Dev and Content Management with Adobe Experience ManagerSummit 2015: Mobile App Dev and Content Management with Adobe Experience Manager
Summit 2015: Mobile App Dev and Content Management with Adobe Experience Manager
 
Tracxn Research — Mobile Dev Tools Landscape, November 2016
Tracxn Research — Mobile Dev Tools Landscape, November 2016Tracxn Research — Mobile Dev Tools Landscape, November 2016
Tracxn Research — Mobile Dev Tools Landscape, November 2016
 
Android Dev Tools Knowledge
Android Dev Tools KnowledgeAndroid Dev Tools Knowledge
Android Dev Tools Knowledge
 
2nd Athens Android Dev Meetup: Hello Android, from zero to hello
2nd Athens Android Dev Meetup: Hello Android, from zero to hello2nd Athens Android Dev Meetup: Hello Android, from zero to hello
2nd Athens Android Dev Meetup: Hello Android, from zero to hello
 
PPT Companion to Android
PPT Companion to AndroidPPT Companion to Android
PPT Companion to Android
 
Android ppt
Android ppt Android ppt
Android ppt
 

Similar a Android dev tips

Consistent UI Across Android Devices
Consistent UI Across Android DevicesConsistent UI Across Android Devices
Consistent UI Across Android DevicesIrene Duke
 
Android Studio development model and.pptx
Android Studio development model and.pptxAndroid Studio development model and.pptx
Android Studio development model and.pptxVaibhavKhunger2
 
Android webinar class_1
Android webinar class_1Android webinar class_1
Android webinar class_1Edureka!
 
Introduction to android sessions new
Introduction to android   sessions newIntroduction to android   sessions new
Introduction to android sessions newJoe Jacob
 
Android app development by abhi android
Android app development by abhi androidAndroid app development by abhi android
Android app development by abhi androidsusijanny
 
Android app development
Android app developmentAndroid app development
Android app developmentAbhishek Saini
 
Introduction to android basics
Introduction to android basicsIntroduction to android basics
Introduction to android basicsHasam Panezai
 
Android project architecture
Android project architectureAndroid project architecture
Android project architectureSourabh Sahu
 
Beating Android Fragmentation, Brett Duncavage
Beating Android Fragmentation, Brett DuncavageBeating Android Fragmentation, Brett Duncavage
Beating Android Fragmentation, Brett DuncavageXamarin
 
Learn Android at edureka!
Learn Android at edureka! Learn Android at edureka!
Learn Android at edureka! Edureka!
 
Developing for Android-Types of Android Application
Developing for Android-Types of Android ApplicationDeveloping for Android-Types of Android Application
Developing for Android-Types of Android ApplicationNandini Prabhu
 
Browser Developer Tools for APEX Developers
Browser Developer Tools for APEX DevelopersBrowser Developer Tools for APEX Developers
Browser Developer Tools for APEX DevelopersChristian Rokitta
 
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013DuckMa
 
Part 2 android application development 101
Part 2 android application development 101Part 2 android application development 101
Part 2 android application development 101Michael Angelo Rivera
 

Similar a Android dev tips (20)

Consistent UI Across Android Devices
Consistent UI Across Android DevicesConsistent UI Across Android Devices
Consistent UI Across Android Devices
 
Android Studio development model and.pptx
Android Studio development model and.pptxAndroid Studio development model and.pptx
Android Studio development model and.pptx
 
Android webinar class_1
Android webinar class_1Android webinar class_1
Android webinar class_1
 
Android
Android Android
Android
 
Introduction to android sessions new
Introduction to android   sessions newIntroduction to android   sessions new
Introduction to android sessions new
 
Android app development by abhi android
Android app development by abhi androidAndroid app development by abhi android
Android app development by abhi android
 
Android app development
Android app developmentAndroid app development
Android app development
 
Introduction to android basics
Introduction to android basicsIntroduction to android basics
Introduction to android basics
 
Android project architecture
Android project architectureAndroid project architecture
Android project architecture
 
Beating Android Fragmentation, Brett Duncavage
Beating Android Fragmentation, Brett DuncavageBeating Android Fragmentation, Brett Duncavage
Beating Android Fragmentation, Brett Duncavage
 
Session 2 beccse
Session 2 beccseSession 2 beccse
Session 2 beccse
 
Learn Android at edureka!
Learn Android at edureka! Learn Android at edureka!
Learn Android at edureka!
 
Intro to android (gdays)
Intro to android (gdays)Intro to android (gdays)
Intro to android (gdays)
 
Developing for Android-Types of Android Application
Developing for Android-Types of Android ApplicationDeveloping for Android-Types of Android Application
Developing for Android-Types of Android Application
 
Android - Android Application Configuration
Android - Android Application ConfigurationAndroid - Android Application Configuration
Android - Android Application Configuration
 
Browser Developer Tools for APEX Developers
Browser Developer Tools for APEX DevelopersBrowser Developer Tools for APEX Developers
Browser Developer Tools for APEX Developers
 
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
 
Chapter 9 - Resources System
Chapter 9 - Resources SystemChapter 9 - Resources System
Chapter 9 - Resources System
 
iOS Application Exploitation
iOS Application ExploitationiOS Application Exploitation
iOS Application Exploitation
 
Part 2 android application development 101
Part 2 android application development 101Part 2 android application development 101
Part 2 android application development 101
 

Más de Kanda Runapongsa Saikaew

ความรู้ไอทีช่วยเลี้ยงลูกได้
ความรู้ไอทีช่วยเลี้ยงลูกได้ความรู้ไอทีช่วยเลี้ยงลูกได้
ความรู้ไอทีช่วยเลี้ยงลูกได้Kanda Runapongsa Saikaew
 
ใช้ไอทีอย่างไรให้เป็นประโยชน์ เหมาะสม และปลอดภัย
ใช้ไอทีอย่างไรให้เป็นประโยชน์ เหมาะสม และปลอดภัยใช้ไอทีอย่างไรให้เป็นประโยชน์ เหมาะสม และปลอดภัย
ใช้ไอทีอย่างไรให้เป็นประโยชน์ เหมาะสม และปลอดภัยKanda Runapongsa Saikaew
 
บริการไอทีของมหาวิทยาลัยขอนแก่นเพื่อนักศึกษา
บริการไอทีของมหาวิทยาลัยขอนแก่นเพื่อนักศึกษาบริการไอทีของมหาวิทยาลัยขอนแก่นเพื่อนักศึกษา
บริการไอทีของมหาวิทยาลัยขอนแก่นเพื่อนักศึกษาKanda Runapongsa Saikaew
 
Using Facebook as a Supplementary Tool for Teaching and Learning
Using Facebook as a Supplementary Tool for Teaching and LearningUsing Facebook as a Supplementary Tool for Teaching and Learning
Using Facebook as a Supplementary Tool for Teaching and LearningKanda Runapongsa Saikaew
 
วิธีการติดตั้งและใช้ Dropbox
วิธีการติดตั้งและใช้ Dropboxวิธีการติดตั้งและใช้ Dropbox
วิธีการติดตั้งและใช้ DropboxKanda Runapongsa Saikaew
 
Using Facebook and Google Docs for Teaching and Sharing Information
Using Facebook and Google Docs for Teaching and Sharing InformationUsing Facebook and Google Docs for Teaching and Sharing Information
Using Facebook and Google Docs for Teaching and Sharing InformationKanda Runapongsa Saikaew
 
เครื่องมือเทคโนโลยีสารสนเทศฟรีที่น่าใช้
เครื่องมือเทคโนโลยีสารสนเทศฟรีที่น่าใช้เครื่องมือเทคโนโลยีสารสนเทศฟรีที่น่าใช้
เครื่องมือเทคโนโลยีสารสนเทศฟรีที่น่าใช้Kanda Runapongsa Saikaew
 
การใช้เฟซบุ๊กเพื่อแลกเปลี่ยนเรียนรู้
การใช้เฟซบุ๊กเพื่อแลกเปลี่ยนเรียนรู้การใช้เฟซบุ๊กเพื่อแลกเปลี่ยนเรียนรู้
การใช้เฟซบุ๊กเพื่อแลกเปลี่ยนเรียนรู้Kanda Runapongsa Saikaew
 
คู่มือการใช้ Dropbox
คู่มือการใช้ Dropboxคู่มือการใช้ Dropbox
คู่มือการใช้ DropboxKanda Runapongsa Saikaew
 
การใช้เฟซบุ๊กเพื่อการเรียนการสอน
การใช้เฟซบุ๊กเพื่อการเรียนการสอนการใช้เฟซบุ๊กเพื่อการเรียนการสอน
การใช้เฟซบุ๊กเพื่อการเรียนการสอนKanda Runapongsa Saikaew
 
การใช้เฟซบุ๊กอย่างปลอดภัยและสร้างสรรค์
การใช้เฟซบุ๊กอย่างปลอดภัยและสร้างสรรค์การใช้เฟซบุ๊กอย่างปลอดภัยและสร้างสรรค์
การใช้เฟซบุ๊กอย่างปลอดภัยและสร้างสรรค์Kanda Runapongsa Saikaew
 
Social Media (โซเชียลมีเดีย)
Social Media (โซเชียลมีเดีย)Social Media (โซเชียลมีเดีย)
Social Media (โซเชียลมีเดีย)Kanda Runapongsa Saikaew
 
Mobile Application for Education (โมบายแอปพลิเคชันเพื่อการศึกษา)
Mobile Application for Education (โมบายแอปพลิเคชันเพื่อการศึกษา)Mobile Application for Education (โมบายแอปพลิเคชันเพื่อการศึกษา)
Mobile Application for Education (โมบายแอปพลิเคชันเพื่อการศึกษา)Kanda Runapongsa Saikaew
 

Más de Kanda Runapongsa Saikaew (20)

ความรู้ไอทีช่วยเลี้ยงลูกได้
ความรู้ไอทีช่วยเลี้ยงลูกได้ความรู้ไอทีช่วยเลี้ยงลูกได้
ความรู้ไอทีช่วยเลี้ยงลูกได้
 
Google Apps Basic for Education
Google Apps Basic for Education Google Apps Basic for Education
Google Apps Basic for Education
 
Moodle basics
Moodle basicsMoodle basics
Moodle basics
 
Thai socialmedia
Thai socialmediaThai socialmedia
Thai socialmedia
 
Introduction to JSON
Introduction to JSONIntroduction to JSON
Introduction to JSON
 
Introduction to Google+
Introduction to Google+Introduction to Google+
Introduction to Google+
 
ใช้ไอทีอย่างไรให้เป็นประโยชน์ เหมาะสม และปลอดภัย
ใช้ไอทีอย่างไรให้เป็นประโยชน์ เหมาะสม และปลอดภัยใช้ไอทีอย่างไรให้เป็นประโยชน์ เหมาะสม และปลอดภัย
ใช้ไอทีอย่างไรให้เป็นประโยชน์ เหมาะสม และปลอดภัย
 
บริการไอทีของมหาวิทยาลัยขอนแก่นเพื่อนักศึกษา
บริการไอทีของมหาวิทยาลัยขอนแก่นเพื่อนักศึกษาบริการไอทีของมหาวิทยาลัยขอนแก่นเพื่อนักศึกษา
บริการไอทีของมหาวิทยาลัยขอนแก่นเพื่อนักศึกษา
 
Baby Health Journal
Baby Health Journal Baby Health Journal
Baby Health Journal
 
Using Facebook as a Supplementary Tool for Teaching and Learning
Using Facebook as a Supplementary Tool for Teaching and LearningUsing Facebook as a Supplementary Tool for Teaching and Learning
Using Facebook as a Supplementary Tool for Teaching and Learning
 
วิธีการติดตั้งและใช้ Dropbox
วิธีการติดตั้งและใช้ Dropboxวิธีการติดตั้งและใช้ Dropbox
วิธีการติดตั้งและใช้ Dropbox
 
Using Facebook and Google Docs for Teaching and Sharing Information
Using Facebook and Google Docs for Teaching and Sharing InformationUsing Facebook and Google Docs for Teaching and Sharing Information
Using Facebook and Google Docs for Teaching and Sharing Information
 
เครื่องมือเทคโนโลยีสารสนเทศฟรีที่น่าใช้
เครื่องมือเทคโนโลยีสารสนเทศฟรีที่น่าใช้เครื่องมือเทคโนโลยีสารสนเทศฟรีที่น่าใช้
เครื่องมือเทคโนโลยีสารสนเทศฟรีที่น่าใช้
 
การใช้เฟซบุ๊กเพื่อแลกเปลี่ยนเรียนรู้
การใช้เฟซบุ๊กเพื่อแลกเปลี่ยนเรียนรู้การใช้เฟซบุ๊กเพื่อแลกเปลี่ยนเรียนรู้
การใช้เฟซบุ๊กเพื่อแลกเปลี่ยนเรียนรู้
 
คู่มือการใช้ Dropbox
คู่มือการใช้ Dropboxคู่มือการใช้ Dropbox
คู่มือการใช้ Dropbox
 
การใช้เฟซบุ๊กเพื่อการเรียนการสอน
การใช้เฟซบุ๊กเพื่อการเรียนการสอนการใช้เฟซบุ๊กเพื่อการเรียนการสอน
การใช้เฟซบุ๊กเพื่อการเรียนการสอน
 
การใช้เฟซบุ๊กอย่างปลอดภัยและสร้างสรรค์
การใช้เฟซบุ๊กอย่างปลอดภัยและสร้างสรรค์การใช้เฟซบุ๊กอย่างปลอดภัยและสร้างสรรค์
การใช้เฟซบุ๊กอย่างปลอดภัยและสร้างสรรค์
 
Social Media (โซเชียลมีเดีย)
Social Media (โซเชียลมีเดีย)Social Media (โซเชียลมีเดีย)
Social Media (โซเชียลมีเดีย)
 
Mobile Application for Education (โมบายแอปพลิเคชันเพื่อการศึกษา)
Mobile Application for Education (โมบายแอปพลิเคชันเพื่อการศึกษา)Mobile Application for Education (โมบายแอปพลิเคชันเพื่อการศึกษา)
Mobile Application for Education (โมบายแอปพลิเคชันเพื่อการศึกษา)
 
Google bigtableappengine
Google bigtableappengineGoogle bigtableappengine
Google bigtableappengine
 

Último

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 

Último (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 

Android dev tips

  • 1. Android Dev Tips Kanda Runapongsa Saikaew
  • 2. Agenda 1.  2.  3.  4.  5.  Love Relative Layout Use Hierarchy Viewer Use Eclipse Effectively Use LogCat Publish Application
  • 3. 1. Love Relative Layout •  Most of the tutorials use LinearLayout, but you will find •  •  that RelativeLayout is truly useful A common example is the abuse of LinearLayout, which leads to a proliferation of views in the view hierarchy Every view, or worse every layout manager, you add to your application comes at a cost: initialization, layout and drawing become slower
  • 6. 2. Use Hierarchy Viewer •  The Android SDK tools include a tool called Hierarchy Viewer that allows you to analyze your layout while your application is running •  Hierarchy Viewer works by allowing you to select running processes on a connected device or emulator, then display the layout tree •  The traffic lights on each block represent its Measure, Layout and Draw performance, helping you identify potential issues.
  • 7. Using HierarchyViewer •  •  The hierarchyviewer tool is available in <sdk>/tools/ When opened, the Hierarchy Viewer shows a list of available devices and its running components
  • 8. Using Hierarchy Viewer •  Click Load View Hierarchy to view the layout hierarchy of the selected component
  • 9. Using Hierarchy Viewer -  A small bitmap image on the left -  Two stacked items of text on the right
  • 11. Using LinearLayout •  There is a 3-level hierarchy with some problems laying out the text items •  The timings for rendering a complete list item using this layout are •  •  •  Measure: 0.977ms Layout: 0.167ms Draw: 2.717ms
  • 13. Using RelativeLayout •  Because the layout performance above slows down due to a nested LinearLayout •  The performance might improve by flattening the layout— make the layout shallow and wide, rather than narrow and deep •  Now rendering a list item takes •  Measure: 0.598ms •  Layout: 0.110ms •  Draw: 2.146ms
  • 14. 3. Use Eclipse Effectively •  •  •  You should try to keep your hands on keyboard The less you touch the mouse, the more code you can write I am trying to keep the mouse laying still and control the IDE completely using keyboard.
  • 15. Eclipse Short Cut Keys •  •  •  •  •  Ctrl + D Ctrl + 1 Ctrl + Shift + O Ctrl + Shift + F Ctrl + Shift + L Delete row Activates the quick fix Organize imports Format codes Shows you a list of your currently defined shortcut keys
  • 16. 4. Use LogCat •  It can be difficult in Android to figure out •  “what went wrong”. LogCat will show cause of the problems. o  o  Error message with red string. Problems that cause by …. (something) with line of that code.
  • 17. How to Use LogCat •  To use LogCat, first import android.util.Log into your project •  Now you can call the static class Log from your project to start logging •  Logcat has different levels of logging
  • 18. Different Levels of Logging V — Verbose (lowest priority) D — Debug I — Info W — Warning E — Error F — Fatal S — Silent (highest priority, on which nothing is ever printed)
  • 19. Setting Different Colors for Different Levels •  Go to Preferences > LogCat > Colors
  • 20. Example of Using Log Class
  • 21. How to View LogCat •  •  •  Open LogCat view by clicking the LogCat icon at the bottom right corner (1 in the figure) Filter LogCat level (2 in the figure) Search for some keyword (3 in the figure)
  • 22. 5. Publish Application •  Prepare the application for release •  Release the application to users
  • 23. Configure Your Application for Release •  Choose a good package •  The package name cannot start with com.example •  Turn off logging and debugging •  •  •  Remove Log calls Remove android:debuggable attribute from your manifest file Remove all Debug tracing calls such as startMethodTracing()
  • 24. Configure Your Application for Release •  Clean up your directory •  Review the contents of your jni/, lib/, and src/ directories •  The jni/ directory should contain only source files associated with the Android NDK, such as .c, .cpp, .h, and .mk files •  The lib/ directory should contain only third-party library files or private library files, including prebuilt shared and static libraries •  The src/ directory should not contain any .jar files.
  • 25. Configure Your Application for Release •  Review and update your manifest settings •  <uses-permission> element •  You should specify only those permissions that are relevant and required for application •  android:icon and android:label attributes •  You must specify values for these attributes, which are located in the <application> element •  android:versionCode and android:versionName attributes. •  We recommend that you specify values for these attributes
  • 26. Configure Your Application for Release •  Address compatibility issues •  •  Add support for multiple screen configurations. Optimize your application for Android tablet devices. •  If your application is designed for devices older than Android 3.0, make it compatible with Android 3.0 devices •  Consider using the Support Library. •  If your application is designed for devices running Android 3.x, make your application compatible with older versions of Android
  • 27. Support Different Devices •  Support different languages •  Support different screens •  Different layouts •  Different bitmaps •  Different text sizes
  • 28. Support Different Languages •  •  Create the resource subdirectories and string resource files Example MyProject/ res/ values/ strings.xml values-es/ strings.xml
  • 29. Support Different Languages English (default locale), /values/strings.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <string name="title">My Application</string> <string name="hello_world">Hello World!</string> </resources> Spanish, /values-es/strings.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <string name="title">Mi Aplicación</string> <string name="hello_world">Hola Mundo!</string> </resources>
  • 30. Support Different Screens •  Android categorizes device screens using two general properties: size and density •  There are four generalized sizes: small, normal, large, xlarge •  Four generalized densities: low (ldpi), medium (mdpi), high (hdpi), extra high (xhdpi)
  • 31. Support Different Layouts MyProject/ res/ layout/ main.xml # default (portrait) layout-land/ # landscape main.xml layout-large/ # large (portrait) main.xml layout-large-land/ # large landscape main.xml
  • 32. Support Different Bitmaps •  To generate these images, you should start with your raw resource in vector format and generate the images for each density using the following size scale: •  •  xhdpi: 2.0 hdpi: 1.5 •  •  mdpi: 1.0 (baseline) ldpi: 0.75 •  This means that if you generate a 200x200 image for xhdpi devices, you should generate the same resource in 150x150 for hdpi, 100x100 for mdpi, and 75x75 for ldpi devices.
  • 33. Support Different Bitmaps Then, place the files in the appropriate drawable resource directory: MyProject/ res/ drawable-xhdpi/ awesomeimage.png drawable-hdpi/ awesomeimage.png drawable-mdpi/ awesomeimage.png Any time you reference @drawable/awesomeimage, the system selects the appropriate bitmap based on the screen's density.
  • 34. Support Different Text Sizes •  You should use the resource folders such as values-ldpi values-mdpi values-hdpi •  Write the text size in 'dimensions.xml' file for each range Sample dimensions.xml <?xml version="1.0" encoding="utf-8"?> <resources> <dimen name="textsize">15sp</dimen> </resources> •  In Java code, textView.setTextSize(getResources().getDimension(R.dimen.textsize));
  • 35. What to Test •  Change in orientation •  •  Is the screen re-drawn correctly? Does the application maintain its state? •  Change in configuration •  A situation that is more general than a change in orientation is a change in the device's configuration, such as a change in the availability of a keyboard or a change in system language
  • 36. What to Test •  Battery Life •  •  You need to write your application to minimize battery usage, you need to test its battery performance, and you need to test the methods that manage battery usage. Techniques for minimizing battery usage were presented at the 2010 Google I/O conference in the presentation Coding for Life -- Battery Life, That Is.
  • 37. What to Test •  Dependence on external resources •  If your application depends on network access, SMS, Bluetooth, or GPS, then you should test what happens when the resource or resources are not available •  For example, if your application uses the network, it can notify the user if access is unavailable, or disable network-related features, or do both
  • 39. Thank you Kanda Runapongsa Saikaew •  Khon Kaen University, Thailand •  •  •  •  •  Assistant Professor of Department of Computer Engineering Associate Director for Administration of Computer Center krunapon@kku.ac.th Twitter: @krunapon G+: https://plus.google.com/u/0/118244887738724224199