Download - DevFest Sul 2014 - Android 4 lazy iOS Devs
![Page 1: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/1.jpg)
Give yourself to the Dark Side!
Jackson F. de A. Mafra
![Page 2: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/2.jpg)
http://developer.android.com/design/index.html
follow this, seriously!
![Page 3: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/3.jpg)
Understand some of the key UI paradigms in use on Android today: the action bar, the overflow menu, the back button, the share action,
and more.
![Page 4: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/4.jpg)
No More Menu Button
![Page 5: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/5.jpg)
New Buttons
![Page 6: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/6.jpg)
Notifications
![Page 7: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/7.jpg)
Navigation
![Page 8: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/8.jpg)
ActionBar
![Page 9: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/9.jpg)
ActionBar
![Page 10: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/10.jpg)
MultiPane
![Page 11: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/11.jpg)
Dialogs
![Page 12: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/12.jpg)
Android is not iOS
![Page 13: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/13.jpg)
Android is not iOS
![Page 14: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/14.jpg)
IDE
Android Studio
or
(Eclipse ADT plugin)
![Page 15: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/15.jpg)
Android SDK and AVD Manager
![Page 16: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/16.jpg)
Language Application Structure
There are many differences between Objective-C and Java
![Page 17: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/17.jpg)
Java
Say what you will about Java, in the end it's just another language. Be thankful there is no J2EE
in sight.
![Page 18: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/18.jpg)
Language Application Structure
Referencing this.object will not call your custom getter. You must use this.getObject.
![Page 19: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/19.jpg)
Language Application Structure
Java methods are typically written as actions or queries, such as getCell(), instead of
cellForRowAtIndexPath:.
![Page 20: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/20.jpg)
Simulator
I used to think the iOS simulator was painful, now I realise it's pretty awesome.
Skip the Android simulator all together and deploy to a real device, or be prepared to spend
a lot of time waiting.
Consider to use Genymotion, a fastest Android emulator for app testing and presentation.
![Page 21: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/21.jpg)
Project Structure
Android applications are primarily broken into two sections, the first of which is the Java
source code.
![Page 22: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/22.jpg)
Project Structure
The source code is structured via the Java package hierarchy, and it can be structured as you please. However, a common practice is to
use top-level categories for activities, fragments, views, adapters, and data (models
and managers).
![Page 23: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/23.jpg)
Project Structure
The second major section is the res folder, short for ‘resource’ folder.
![Page 24: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/24.jpg)
Project Structure
The res folder is a collection of images, XML layout files, and XML value files that make up
the bulk of the non-code assets.
![Page 25: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/25.jpg)
Project Structure
Android uses Layouts which are xml. They are completely independent from each other.
Android Studio also has a nice WYSIWYG editor
![Page 26: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/26.jpg)
Project Structure
On iOS, images are either @2x or not, but on Android there are a number of screen density
folders to consider.
![Page 27: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/27.jpg)
Project Structure
Android uses folders to arrange images, strings, and other values for screen density.
![Page 28: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/28.jpg)
Project Structure
One last correlation in project structure is the AndroidManifest.xml file.
![Page 29: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/29.jpg)
Project Structure
This file is the equivalent of the Project-Info.plist file on iOS, and it stores information for
activities, application names, and set Intents (system-level events) that the application can
handle.
![Page 30: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/30.jpg)
Activities
Activities are the basic visual unit of an Android app, just as UIViewControllers are
the basic visual component on iOS.
![Page 31: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/31.jpg)
Activities
Instead of a UINavigationController, the Android OS keeps an activity stack that it
manages.
![Page 32: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/32.jpg)
Activities
In essence, the activity lifecycle is very similar to the UIViewController lifecycle.
![Page 33: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/33.jpg)
Activities
![Page 34: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/34.jpg)
Fragments
The Fragment concept is unique to Android and came around somewhat recently in
Android 3.0 (2010).
![Page 35: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/35.jpg)
Fragments
Fragments are mini controllers that can be instantiated to fill activities.
![Page 36: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/36.jpg)
Fragments
Also note that fragments do not have their own contexts and they rely heavily on activities for
their connection to the application’s state.
![Page 37: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/37.jpg)
Fragments
Tablets are a great fragment use case example: you can place a list fragment on the left and a
detail fragment on the right.
![Page 38: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/38.jpg)
Fragments
Fragments allow you to break up your UI and controller logic into smaller, reusable chunks.
![Page 39: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/39.jpg)
List Views and Adapters
ListViews are the closest approximation to UITableView on Android, and they are one of the most common components that you will
use.
![Page 40: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/40.jpg)
List Views and Adapters
Like UITableView has a helper view controller, UITableViewController, ListView also has a
helper activity, ListActivity, and a helper fragment, ListFragment.
![Page 41: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/41.jpg)
List Views and Adapters
On Android we don’t have datasources and delegates for ListView.
![Page 42: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/42.jpg)
List Views and Adapters
We have adapters. Adapters come in many forms, but their primary goal is similar to a
datasource and table view delegate all in one.
![Page 43: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/43.jpg)
List Views and Adapters
Adapters take data and adapt it to populate a ListView by instantiating views the ListView
will display
![Page 44: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/44.jpg)
AsyncTasks
In place of Grand Central Dispatch on iOS, on Android we have access to AsyncTasks.
![Page 45: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/45.jpg)
AsyncTasks
AsyncTasks is a different take on exposing asynchronous tools in a more friendly way.
![Page 46: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/46.jpg)
Layout
The primary structure that you will deal with will be subclasses of ViewGroup –
RelativeLayout, LinearLayout, and FrameLayout are the most common.
![Page 47: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/47.jpg)
Layout
Always work in dp (density-independent pixels) instead of pixels directly.
![Page 48: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/48.jpg)
Data
The Data Storage Options available on Android are also very similar to what is available on iOS
![Page 49: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/49.jpg)
Data
Shared Preferences <-> NSUserDefaults
![Page 50: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/50.jpg)
Data
Saving to and fetching from file structure via the internal or external file storage <-> saving
to the documents directory
![Page 51: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/51.jpg)
Data
SQLite <-> Core Data
![Page 52: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/52.jpg)
Data
Android offers straight access to the SQLite database and returns cursor objects for results
![Page 53: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/53.jpg)
IBOutlet
If you are anything like me you forget to connect IBOutlets at least 50% of the time
every time.
![Page 54: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/54.jpg)
IBOutlet
With Android every view/component has a unique ID, something like:
@+id/myButton
Button button = (Button)findViewById(R.id.myButton);
![Page 55: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/55.jpg)
NSLog
Log seems to be the go to solution here, you can specify debug, verbose etc.
System.out.println(..) also seems to do the job.
![Page 56: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/56.jpg)
Paid Apple $99 developer fee
x
Paid Google $25 developer fee
![Page 57: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/57.jpg)
$25 fee in Play Store.
75% cheaper than Apple's yearly fee.
![Page 58: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/58.jpg)
Payments handled through Google Checkout.
![Page 59: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/59.jpg)
Referenceshttp://www.objc.io/issue-11/android_101_for_ios_developers.html
http://www.bignerdranch.com/blog/learning-android-development-ios-developers-perspective/
http://stuartkhall.com/posts/android-development-tips-for-ios-devs
http://clayallsopp.com/android/9-uploading-to-market.html
http://developer.android.com/design/patterns/pure-android.html
http://www.prnewswire.com/news-releases/strategy-analytics-android-captures-79-percent-share-of-global-smartphone-shipments-in-2013-242563381.html
![Page 60: DevFest Sul 2014 - Android 4 lazy iOS Devs](https://reader033.vdocuments.mx/reader033/viewer/2022051609/547e6f115906b5ab718b469b/html5/thumbnails/60.jpg)
@jacksonfdam
Thank you