Android	
  User	
  
  Interface	
  


 Marko	
  Gargenta	
  
   Marakana	
  
HELLO	
  WORLD!	
  
Create	
  New	
  Project
                                         	
  
Use the Eclipse tool to create a new
Android project.

Here are some key constructs:


Project	
          Eclipse	
  construct	
  
Target	
           minimum	
  to	
  run	
  
App	
  name	
      whatever	
  
Package	
          Java	
  package	
  
AcBvity	
          Java	
  class	
  
The	
  Manifest	
  File	
  
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.marakana"
   android:versionCode="1"
   android:versionName="1.0">
  <application android:icon="@drawable/icon"
        android:label="@string/app_name">
    <activity android:name=".HelloAndroid"
           android:label="@string/app_name">
       <intent-filter>
          <action android:name="android.intent.action.MAIN" />
          <category android:name="android.intent.category.LAUNCHER" />
       </intent-filter>
    </activity>
  </application>
  <uses-sdk android:minSdkVersion="5" />
</manifest>
The	
  Layout	
  Resource	
  

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  >
<TextView
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:text="@string/hello"
  />
</LinearLayout>
The	
  Java	
  File	
  
package com.marakana;

import android.app.Activity;
import android.os.Bundle;

public class HelloAndroid extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.main);
  }
}
ANDROID	
  USER	
  INTERFACE	
  
Two	
  UI	
  Approaches	
  
Procedural	
                              Declara;ve	
  
You	
  write	
  Java	
  code	
            You	
  write	
  XML	
  code	
  
Similar	
  to	
  Swing	
  or	
  AWT	
     Similar	
  to	
  HTML	
  of	
  a	
  web	
  page	
  




You can mix and match both styles.
Declarative is preferred: easier and
more tools
XML-­‐Based	
  User	
  Interface	
  




Use WYSIWYG tools to build powerful XML-based UI.
Easily customize it from Java. Separate concerns.
Dips	
  and	
  Sps	
  

px	
  (pixel)	
                                 Dots	
  on	
  the	
  screen	
  
in	
  (inches)	
                                Size	
  as	
  measured	
  by	
  a	
  ruler	
  
mm	
  (millimeters)	
                           Size	
  as	
  measured	
  by	
  a	
  ruler	
  
pt	
  (points)	
                                1/72	
  of	
  an	
  inch	
  
dp	
  (density-­‐independent	
  pixel)	
        Abstract	
  unit.	
  On	
  screen	
  with	
  160dpi,	
  
                                                1dp=1px	
  
dip	
                                           synonym	
  for	
  dp	
  and	
  o^en	
  used	
  by	
  Google	
  
sp	
                                            Similar	
  to	
  dp	
  but	
  also	
  scaled	
  by	
  users	
  font	
  
                                                size	
  preference	
  
Views	
  and	
  Layouts
                          	
  

                    ViewGroup




        ViewGroup               View




 View     View      View




ViewGroups contain other Views but
are also Views themselves.
Common	
  UI	
  Components
                                	
  
Android UI includes many
common modern UI
widgets, such as Buttons,
Tabs, Progress Bars, Date
and Time Pickers, etc.
SelecBon	
  Components
                              	
  

Some UI widgets may
be linked to zillions of
pieces of data.
Examples are ListView
and Spinners
(pull-downs).
Adapters
                         	
  


                      Adapter       Data
                                   Source




To make sure they run smoothly, Android uses
Adapters to connect them to their data sources. A
typical data source is an Array or a Database.
Complex	
  Components
                            	
  
Certain high-level components are simply
available just like Views. Adding a Map or a
Video to your application is almost like adding a
Button or a piece of text.
Menus	
  and	
  Dialogs
                      	
  
Graphics	
  &	
  AnimaBon	
  
Android has rich support for 2D graphics.
You can draw & animate from XML.
You can use OpenGL for 3D graphics.
MulBmedia	
  
AudioPlayer lets you simply specify
the audio resource and play it.

VideoView is a View that you can
drop anywhere in your activity, point
to a video file and play it.

XML:
<VideoView
  android:id="@+id/video"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:layout_gravity="center” />

Java:
player = (VideoView) findViewById(R.id.video);
player.setVideoPath("/sdcard/samplevideo.3gp");
player.start();
Google	
  Maps
                                      	
  
Google Maps is an add-on in Android.
It is not part of open-source project.

However, adding Maps is relatively
easy using MapView.


XML:
<com.google.android.maps.MapView
android:id="@+id/map"
android:clickable="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0EfLSgdSCWIN…A"
/>
Building	
  UI	
  for	
  Performance	
  




A handy Hierarchy Viewer tool helps with optimizing the UI for performance
Summary	
  
     Main difference between Java and
     Android is User Interface.

     Android has two approaches to UI:
     programmatic and declarative. Best
     practice is to use both.

     Lifecycle of an activity is very
     important for overall performance of
     your app. So, optimize your UI.



     Marko Gargenta, Marakana.com
     marko@marakana.com
     +1-415-647-7000

     Licensed under Creative Commons
     License (cc-by-nc-nd). Please Share!

More Related Content

PDF
Marakana android-java developers
PPTX
Android Workshop: Day 1 Part 3
PPTX
Android Tutorials : Basic widgets
PPTX
Day 15: Working in Background
PPT
Day: 2 Environment Setup for Android Application Development
PPT
Android User Interface: Basic Form Widgets
PPT
Multiple Activity and Navigation Primer
PPTX
Android MapView and MapActivity
Marakana android-java developers
Android Workshop: Day 1 Part 3
Android Tutorials : Basic widgets
Day 15: Working in Background
Day: 2 Environment Setup for Android Application Development
Android User Interface: Basic Form Widgets
Multiple Activity and Navigation Primer
Android MapView and MapActivity

What's hot (20)

PDF
Android session 2
PPTX
Android Widget
PDF
Android session 3
DOCX
Android Tutorial For Beginners Part-1
PPT
Londroid Android Home Screen Widgets
PPTX
Android UI
PDF
Android session 1
PPTX
Android Application Component: BroadcastReceiver Tutorial
PPT
Day 4: Android: UI Widgets
PPT
Day 3: Getting Active Through Activities
PPT
Day 4: Android: Getting Active through Activities
PPT
android layouts
PPTX
PPT
View groups containers
PPTX
Android Services
PDF
Lecture 3 getting active through activities
PDF
04 user interfaces
DOCX
Android xml-based layouts-chapter5
PDF
Android ui layout
PDF
Day 8: Dealing with Lists and ListViews
Android session 2
Android Widget
Android session 3
Android Tutorial For Beginners Part-1
Londroid Android Home Screen Widgets
Android UI
Android session 1
Android Application Component: BroadcastReceiver Tutorial
Day 4: Android: UI Widgets
Day 3: Getting Active Through Activities
Day 4: Android: Getting Active through Activities
android layouts
View groups containers
Android Services
Lecture 3 getting active through activities
04 user interfaces
Android xml-based layouts-chapter5
Android ui layout
Day 8: Dealing with Lists and ListViews
Ad

Viewers also liked (20)

PPT
Corporate Wellness - Presented by Beneplan & the House of Verona
PPTX
Smoking Hypnosis - Say No To The Cancer Sticks
PPT
Presentación earth, air, weather, pollution
PDF
Your Data, Your Interface
PPT
Resursele Regenerabile (2)
PDF
Rusu 2012 clubs affil pack
PPT
Llengües d'origen 30 setembre 2011
PPTX
Mitä mun puhelin2909
PPTX
Quick prototyping apps using JS - Ciklum, Vinnitsa
PPTX
Alan Stevens - #smib10 Presentation
PPT
Marketing Innovation In India
PDF
Creative loverz (workshop)
PPT
David Parfect - #smib10 Presentation
PDF
Android for Java Developers at OSCON 2010
PDF
24015127 Consell Social De La Llengua Catalana Llengua I Joves
PDF
Android Internals
PPT
Effective Benefit Plan Administration
DOCX
Reinforcement 4
PPT
Copia De Loba
PPT
New Orleans Tag11 09 Linked In
Corporate Wellness - Presented by Beneplan & the House of Verona
Smoking Hypnosis - Say No To The Cancer Sticks
Presentación earth, air, weather, pollution
Your Data, Your Interface
Resursele Regenerabile (2)
Rusu 2012 clubs affil pack
Llengües d'origen 30 setembre 2011
Mitä mun puhelin2909
Quick prototyping apps using JS - Ciklum, Vinnitsa
Alan Stevens - #smib10 Presentation
Marketing Innovation In India
Creative loverz (workshop)
David Parfect - #smib10 Presentation
Android for Java Developers at OSCON 2010
24015127 Consell Social De La Llengua Catalana Llengua I Joves
Android Internals
Effective Benefit Plan Administration
Reinforcement 4
Copia De Loba
New Orleans Tag11 09 Linked In
Ad

Similar to Marakana Android User Interface (20)

PPT
PPT Companion to Android
PDF
Android Deep Dive
PPTX
Java talks. Android intoduction for develompment
PPT
Build Mobile Application In Android
PPTX
Technology and Android.pptx
PPTX
DevFest Sul 2014 - Android 4 lazy iOS Devs
PPTX
Introduction to Android Development
PPTX
PPT
Industrial Training in Android Application
PPT
Synapseindia android apps intro to android development
PDF
Android Introduction
PDF
Android tutorial
PDF
Baparekraf Digital Talent Day: Monitoring dan Coaching Penerima Fasilitasi BD...
PDF
Training Session 2 - Day 2
PPTX
Android app development ppt
ODP
Nativa Android Applications development
PPTX
Mobile application development
PPTX
Intro to android (gdays)
PPTX
Seminar on android app development
PPT
Part 2 android application development 101
PPT Companion to Android
Android Deep Dive
Java talks. Android intoduction for develompment
Build Mobile Application In Android
Technology and Android.pptx
DevFest Sul 2014 - Android 4 lazy iOS Devs
Introduction to Android Development
Industrial Training in Android Application
Synapseindia android apps intro to android development
Android Introduction
Android tutorial
Baparekraf Digital Talent Day: Monitoring dan Coaching Penerima Fasilitasi BD...
Training Session 2 - Day 2
Android app development ppt
Nativa Android Applications development
Mobile application development
Intro to android (gdays)
Seminar on android app development
Part 2 android application development 101

More from Marko Gargenta (13)

PDF
Open Android
PDF
LTE: Building New Killer Apps
PDF
Java Champion Wanted
PDF
Android Beyond The Phone
PDF
Android for Java Developers
PDF
Android Internals
PDF
Android: A 9,000-foot Overview
PDF
Marakana Android Internals
PDF
Scrum Overview
PDF
Android For Managers Slides
ODP
Why Python by Marilyn Davis, Marakana
PDF
Jens Østergaard on Why Scrum Is So Hard
PDF
Jens Østergaard on Why Scrum Is So Hard
Open Android
LTE: Building New Killer Apps
Java Champion Wanted
Android Beyond The Phone
Android for Java Developers
Android Internals
Android: A 9,000-foot Overview
Marakana Android Internals
Scrum Overview
Android For Managers Slides
Why Python by Marilyn Davis, Marakana
Jens Østergaard on Why Scrum Is So Hard
Jens Østergaard on Why Scrum Is So Hard

Recently uploaded (20)

PDF
LMS bot: enhanced learning management systems for improved student learning e...
PDF
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
PDF
Build Real-Time ML Apps with Python, Feast & NoSQL
PPTX
Build automations faster and more reliably with UiPath ScreenPlay
PDF
Auditboard EB SOX Playbook 2023 edition.
PDF
Dell Pro Micro: Speed customer interactions, patient processing, and learning...
PDF
Planning-an-Audit-A-How-To-Guide-Checklist-WP.pdf
PDF
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
PDF
giants, standing on the shoulders of - by Daniel Stenberg
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PDF
Advancing precision in air quality forecasting through machine learning integ...
PDF
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
PPTX
Presentation - Principles of Instructional Design.pptx
PDF
zbrain.ai-Scope Key Metrics Configuration and Best Practices.pdf
PDF
Connector Corner: Transform Unstructured Documents with Agentic Automation
PDF
Human Computer Interaction Miterm Lesson
PDF
Examining Bias in AI Generated News Content.pdf
PDF
CEH Module 2 Footprinting CEH V13, concepts
PDF
Decision Optimization - From Theory to Practice
PDF
AI.gov: A Trojan Horse in the Age of Artificial Intelligence
LMS bot: enhanced learning management systems for improved student learning e...
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
Build Real-Time ML Apps with Python, Feast & NoSQL
Build automations faster and more reliably with UiPath ScreenPlay
Auditboard EB SOX Playbook 2023 edition.
Dell Pro Micro: Speed customer interactions, patient processing, and learning...
Planning-an-Audit-A-How-To-Guide-Checklist-WP.pdf
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
giants, standing on the shoulders of - by Daniel Stenberg
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
Advancing precision in air quality forecasting through machine learning integ...
The-2025-Engineering-Revolution-AI-Quality-and-DevOps-Convergence.pdf
Presentation - Principles of Instructional Design.pptx
zbrain.ai-Scope Key Metrics Configuration and Best Practices.pdf
Connector Corner: Transform Unstructured Documents with Agentic Automation
Human Computer Interaction Miterm Lesson
Examining Bias in AI Generated News Content.pdf
CEH Module 2 Footprinting CEH V13, concepts
Decision Optimization - From Theory to Practice
AI.gov: A Trojan Horse in the Age of Artificial Intelligence

Marakana Android User Interface

  • 1. Android  User   Interface   Marko  Gargenta   Marakana  
  • 3. Create  New  Project   Use the Eclipse tool to create a new Android project. Here are some key constructs: Project   Eclipse  construct   Target   minimum  to  run   App  name   whatever   Package   Java  package   AcBvity   Java  class  
  • 4. The  Manifest  File   <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.marakana" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".HelloAndroid" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="5" /> </manifest>
  • 5. The  Layout  Resource   <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> </LinearLayout>
  • 6. The  Java  File   package com.marakana; import android.app.Activity; import android.os.Bundle; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } }
  • 8. Two  UI  Approaches   Procedural   Declara;ve   You  write  Java  code   You  write  XML  code   Similar  to  Swing  or  AWT   Similar  to  HTML  of  a  web  page   You can mix and match both styles. Declarative is preferred: easier and more tools
  • 9. XML-­‐Based  User  Interface   Use WYSIWYG tools to build powerful XML-based UI. Easily customize it from Java. Separate concerns.
  • 10. Dips  and  Sps   px  (pixel)   Dots  on  the  screen   in  (inches)   Size  as  measured  by  a  ruler   mm  (millimeters)   Size  as  measured  by  a  ruler   pt  (points)   1/72  of  an  inch   dp  (density-­‐independent  pixel)   Abstract  unit.  On  screen  with  160dpi,   1dp=1px   dip   synonym  for  dp  and  o^en  used  by  Google   sp   Similar  to  dp  but  also  scaled  by  users  font   size  preference  
  • 11. Views  and  Layouts   ViewGroup ViewGroup View View View View ViewGroups contain other Views but are also Views themselves.
  • 12. Common  UI  Components   Android UI includes many common modern UI widgets, such as Buttons, Tabs, Progress Bars, Date and Time Pickers, etc.
  • 13. SelecBon  Components   Some UI widgets may be linked to zillions of pieces of data. Examples are ListView and Spinners (pull-downs).
  • 14. Adapters   Adapter Data Source To make sure they run smoothly, Android uses Adapters to connect them to their data sources. A typical data source is an Array or a Database.
  • 15. Complex  Components   Certain high-level components are simply available just like Views. Adding a Map or a Video to your application is almost like adding a Button or a piece of text.
  • 17. Graphics  &  AnimaBon   Android has rich support for 2D graphics. You can draw & animate from XML. You can use OpenGL for 3D graphics.
  • 18. MulBmedia   AudioPlayer lets you simply specify the audio resource and play it. VideoView is a View that you can drop anywhere in your activity, point to a video file and play it. XML: <VideoView android:id="@+id/video" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center” /> Java: player = (VideoView) findViewById(R.id.video); player.setVideoPath("/sdcard/samplevideo.3gp"); player.start();
  • 19. Google  Maps   Google Maps is an add-on in Android. It is not part of open-source project. However, adding Maps is relatively easy using MapView. XML: <com.google.android.maps.MapView android:id="@+id/map" android:clickable="true" android:layout_width="fill_parent" android:layout_height="fill_parent" android:apiKey="0EfLSgdSCWIN…A" />
  • 20. Building  UI  for  Performance   A handy Hierarchy Viewer tool helps with optimizing the UI for performance
  • 21. Summary   Main difference between Java and Android is User Interface. Android has two approaches to UI: programmatic and declarative. Best practice is to use both. Lifecycle of an activity is very important for overall performance of your app. So, optimize your UI. Marko Gargenta, Marakana.com [email protected] +1-415-647-7000 Licensed under Creative Commons License (cc-by-nc-nd). Please Share!