Your SlideShare is downloading. ×
0
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Android Debug Bridge via Command Line, MobAppDev Best Practices, UI Development

1,410

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,410
On Slideshare
0
From Embeds
0
Number of Embeds
28
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Android Programming Android Debug Bridge via Command Line MobApDev Best Practices UI Development Vladimir Kulyukinhttp://www.youtube.com/vkedco www.vkedco.blogspot.com
  • 2. Outline ● Android Debug Bridge (ADB) via Command Line ● MobAppDev Best Practices ● UI Development – Views & Containers – Common view properties – Android UI measurement units – Programmatic vs Declarative UI Development: Code vs XML – International Date Display Applicationhttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 3. ADB via Command Linehttp://www.youtube.com/vkedco www.vkedco.blogspot.com
  • 4. ADB is now in /platform-toolshttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 5. ADB is now in /platform-tools 1) List devices connected to the computer 2) Connect to the device and list all processes running on it 3) List contents of the current directoryhttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 6. MobAppDev Best Practiceshttp://www.youtube.com/vkedco www.vkedco.blogspot.com
  • 7. Hardware Constraints ● Compared to their desktop & laptop counterparts, mobile devices have – Low processing power – Limited RAM – Limited permanent storage – Small screens with low resolution – High data transfer costs – Slow data transfer rates – Unreliable data connections – Limited battery lifehttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 8. Efficiency ● Mobile device manufacturers generally prefer small sizes and longer battery lives to processor speed improvements ● To mobile developers such preferences translate to the occasional invalidity of Moores law (number of transistors doubles on an integrated circuit every 2 years) ● A safer bet for mobile developers is increased power efficiency without significant increases in processor powerhttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 9. Efficiency ● Some Android efficiency tips are in conflict with well established design practices, e.g., avoiding setters and getters ● Conventional design practices, such as advocated and practiced by software engineering gurus, are compromised for the sake of efficiency ● But bear in mind the classic tradeoff between clarity and efficiencyhttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 10. Limited Storage ● Most of the available storage on mobile devices goes to music and movies ● Android devices require that applications be installed in the internal memory (apps cannot run from the external SD card) ● Consequently, the size of compiled apps matters: – Use native Android frameworks (e.g., content providers, SQLite, SharedPreferences) to persist, reuse, and share data – Clean up: do not leave files in the file system or records in a database when they are not neededhttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 11. Small Screens ● Users are demanding more and more information- rich UI experience ● This demand is a challenge for small screens ● Several assumptions and recommendations ASSUMPTION RECOMMENDATION User will only glance at your GUI Reduce number of widgets User will relate to intuitive layouts Put most important widgets in the center User will unlikely use a stylus Make your views big enough to support touch User will use different screen resolutions Make your GUIs scale on larger displayshttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 12. Responsiveness ● Android forces apps to be responsive through the Activity Manager and Window Manager services ● If either service detects an unresponsive application, it displays a Force Close dialog boxhttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 13. Responsiveness ● Android monitors two conditions to determine responsiveness – App must respond to a user action within five seconds – Broadcast receiver must return from its onReceive() handler within ten seconds ● Likely culprits in low responsiveness – Network downloads – Complex processing (gaming, image processing) – I/Ohttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 14. Security ● Android basic premise: users take responsibility for the apps they install ● Some best AppDev practices – Require permissions for intents and broadcasts – Handle with care inputs from external resources such as Web, SMS, IM, etc – Avoid exposing access to low-level hardware through your apps ● Caveat: because we are in a classroom, we will take a weak approach to security, but that does not make it any less importanthttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 15. Low Speed, High Latency ● Mobile connections are not as fast, reliable, or available (3G, 4G, and citywide WiFi are slowly changing this assumption) ● It is still safe to assume that your connection will be slow, intermittent, and expensive (in Eclipse IDE, you can simulate it by opening DDMS perspective, finding Emulator Control, and setting Latency to EDGE) ● It is safe to assume that applications will lose data or will not find it when it is required ● It is sometimes the best to limit the functionality of your application then have many bells and whistles fail at run timehttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 16. Costs ● Data transfer services, such as SMS and Geocoding, are not free ● Generic data transfer cost minimization guidelines: – Transfer as little data as possible – Cache data – Stop data transfer when your app is invisible – Keep data update rates low – Expose data transfer rates and costs through user preferenceshttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 17. Respect Users Environment ● Never assume that your app is the most important feature on the device: to most users, a smartphone is firstly a phone, secondly an SMS and email processor, thirdly a camera, and fourthly a media player ● Consequently, your app should be: – Well behaved: does not waste cycles when invisible, switches seamlessly from foreground to background – Polite: does not interrupt current activities – Consistent: presents consistent UIs and data formats – Responsive: does not freeze due to lack of datahttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 18. Seamless User Experience (UE) ● UE is a fuzzy concept ● In many contexts, it stands for consistency in your apps starting, stopping, and transitioning without noticeable delays ● Several tips: – Persist data between sessions – Suspend tasks when they are invisible – De-emphasize “revolutionary” and “unfamiliar” and emphasize “cooperative” and “easily recognizable”http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 19. UI Developmenthttp://www.youtube.com/vkedco www.vkedco.blogspot.com
  • 20. Android Views ● Android GUI widgets are called views (text views, edit texts, buttons, radio buttons, etc) ● Views are grouped into containers (aka box models) ● Common containers are LinearLayout, RelativeLayout, and TableLayout (aka, a grid)http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 21. LinearLayout ● LinearLayout is one of the most common containers used in Android UIs (probably because it provides for simple, intuitive interfaces consisting of item lists) ● LinearLayout has five main properties that the UI designer can manipulate through XML or source code: 1) orientation; 2) fill; 3) weight; 4) gravity; and 5) paddinghttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 22. Orientation Property ● This property specifies whether a View object functions as a row or as a column ● If the value of the property is VERTICAL, the object is a column ● If the value of the property is HORIZONTAL, the object is a rowhttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 23. Fill Model Property ● A Views fill model specifies how much space the view can take in its parent view ● Three possibilities: – hardcoded dimension: 50px – wrap_content: view can fill up its natural space; if it is too big, word wrap will be used – match_parent: fill up all available space in its parent after all other viewss are handledhttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 24. Weight Property ● This property indicates the proportion of the free space the widget should take ● This property is important when several widgets must split the available space inside a container ● For example: several buttons inside a LinearLayouthttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 25. Gravity Property ● The gravity property specifies how the widget should be aligned on the screen (inside its container) ● Some common gravity values are – left – right – center_horizontal – center_verticalhttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 26. Padding Property ● The padding property comes in handy when widgets are tightly clustered inside a container ● android:padding allows you to manipulate the white space between widgets ● You can use – android:paddingLeft – android:paddingRight – android:paddingBottom – android:paddingTophttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 27. Android UI Measurement Units ● PIXEL – dot on screen ● IN – inches ● MM – millimeters ● PT – point – 1/72 of 1 inch ● DP – density independent pixel (DP is a unit on a 160 dpi screen: 1 dp is 1 pixel on a 160 dpi screen) ● DIP – synonym for DP ● SP – scale-independent pixel, similar to DP but scalable by usershttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 28. DP vs SP ● DP has constant ratio to PX: DP = PX * RATIO ● RATIO stays constant regardless of the device ● SP has scalable ratio to PX: DP = PX * RATIO * SCALE, where RATIO is constant but SCALE can be set by user ● Usage guideline: use SP for font sizes and DP/DIP for everything elsehttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 29. Declarative and Procedural UI Development ● Declarative development consists of specifying GUI element in some formal language (XML) and then attaching back end code to consume GUI events (clicks, scrolls, taps, etc.) ● Procedural/Programmatic development consists of coding everything in some programming language (e.g., java.swing.* or java.awt.*) ● Mixed development consists of designing all gadgets in XML and attach code to implement UI logichttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 30. XML-Based UI Design ● The most important step to mastering XML-Based GUI design is to relate visual GUIs with XML code that defines them ● XML specs are used to construct GUI objects they specify via XML inflation ● Why care about XML-Based GUI Design? ● It is not just for Android: – Microsofts Extensible Application Markup Language (XAML) – Adobes Flex – Mozillas XML User Interface Language (XUL)http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 31. XML Inflation <Button android:id=”@+id/button_one” style=”@style/my_button_style” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”@string/button_one_text” /> // XML inflation of the Button View defined above protected Button mButtonOne = null; mButtonOne = (Button) findViewById(R.id.button_one);http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 32. International Date Display App on Gingerbread & Jelly Bean source code at InternationalDateDisplayOnAndroidhttp://www.youtube.com/vkedco www.vkedco.blogspot.com
  • 33. App Specs ● Develop an application that consists of one activity that displays three buttons: one for US locale, one for Italy locale, and one for France locale ● A click on a button displays in the screen the current date according to the rules of the specific locale ● The app should use a vertical LinearLayout to arrange its components ● Dates should be displayed in an EditText ● Buttons should be arranged in a horizontal LinearLayout ● EditText and LinearLayout with buttons should have image backgroundshttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 34. Sample Screenshots 1 2 3 4http://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 35. Activity Viewshttp://www.youtube.com/vkedco http://www.vkedco.blogspot.com
  • 36. References ● developer.android.com ● http://developer.android.com/guide/index.html ● http://developer.android.com/guide/practices/design/performance.html ● http://www.youtube.com/vkedcohttp://www.youtube.com/vkedco www.vkedco.blogspot.com
  • 37. Feedback Bugs, errors to vladimir dot kulyukin at gmail dot comhttp://www.youtube.com/vkedco www.vkedco.blogspot.com

×