Unleash Your Potential - Namagunga Girls Coding Club
Synapse india mobile apps update
1. Synapse India iPhone and
Android OS
Apps Development for the
iPhone and the Android
OS
2. Android
• Need Java 5.0+
• Easiest to use Eclipse 3.3.1+
• Download SDK starter pack from
developer.android.com and invoke SDK
setup program
• Install Eclipse plugin
Help, Install New Software
Android Development Tools
• Tell Eclipse where Android is located
• Windows, Preferences, Android
3. Hello Android
Eclipse File, New, Project,
Android, Android Project
Create Android Virtual Device (AVD)
Window, Android SDK, AVD Manager
Run (on emulator)
To run on phone enable USB debugging
Settings, Applications, USB Debugging
Install USB driver (Windows only)
4. Android App Framework
Created by default
• src -- Hello.java -- main Activity
• res, drawable -- icon.png – app’s icon
• res, values -- strings.xml – constants
• res, layout – main.xml -- screen layout
• AndroidManifest.xml – table of contents
• gen – R.java – references, never touch it
5. Rock Paper Scissors
• Two activities – Rsp and Res
• Layout – TextView over nested layout
• Hook up buttons
• Use an Intent to go from one to the other
• Result activity – text, text, button
Result text enhanced
• Can configure layouts by dragging widgets
and entering properties
6. Ball Game
• Touch ball to score, after 10 ball shrinks
and goes faster
• Easy, medium, hard choices
• Uses a Java view not XML
• Uses the onTouchEvent handler
• Use the onDraw method to draw on a
canvas
7. OpenGL (from Hello Android)
• Rotating cube
• Uses OpenGL ES (embedded systems)
• Draws cube from vertices
• Uses GLRenderer
onSurfaceCreated -- set properties
onSurfaceChanged – update view
onDrawFrame – draw the scene
8. Browser View (from Hello Android)
• An EditText and Button above WebView
• WebView uses loadUrl method to display
web page
• Documentation – developer.android.com
9. iPhone
• Needs Intel Mac, OS X 10.5.4+
• Download SDK and register (free)
developer.apple.com/iphone
• $99 to deploy to iPhone or iPod
• Uses Objective-C
• Launch XCode
• Examples from iPhone SDK Development
10. Hello iPhone
• File, New Project in XCode
• Choose View-based Application
• HelloViewController class and
HelloViewController.xib (nib), freeze-dried
GUI
• HelloAppDelegate manages application
• Use Interface Builder to add Label and
configure color and size in Attributes
inspector
11. Hello User
• Allow user to enter a name
• IBOutlet – reference from code to nib
object, e.g. label, text field
• IBAction – method nib’s objects can call,
e.g. button press handler
• In Interface Builder, connect outlets to
code, connect action Touch Up Inside
event to handler method, sayHello
• Implement the sayHello handler method
12. Movie - MVC
• Create Movie class (the model)
• Labels with movie info, Edit button
• MovieEditorViewController for edit view
with Done button to return to main screen
• Send message in Edit button to start
movie controller
• Send message in Done button to return to
MovieViewController
13.
14. Movie Table
• UITableView, UITableViewDataSource protocol
provides number of rows, add, delete, etc.,
UITableViewDelegate to handle tapping to select
a row
• Uses Navigation-based Application
UINavigationController
UINavigationBar (with Edit and Add buttons)
RootViewContoller (with UITableView)
UINavigationItem
15. Movie Table -2
• UINavigationController maintains
navigation state as a stack of view
controllers.
• Uses an array to hold table data. Initial
array hard-coded. Changes are not saved.
16. Conference -- Core Data
• Built on SQLite
• Managed Object Context – row data
turned into objects
• Managed Object Model – like schema
• Persistence Store Coordinator – connects
to the database
• Double-click on Conference.xcdatamodel
to get screen to configure tables
17. Core Data - 2
• Create Managed Object Class to
represent the model
• Conference has tracks with trackAbstract,
name, sessions
• Edit and Add buttons configured in code in
viewDidLoad method rather than in
Interface Builder
• NSFetchedResultsController – adaptor
between CoreData and table view