Saturday, 5 March 2011

"M"osetta Stone

Some more thoughts on cross-platform mobile development (MonoTouch, MonoDroid and Windows Phone 7) from yesterday's post - a 'rosetta stone' (not this one) to translate between the three platforms (Not that each of these things is exactly equivalent - they're matched up where the concept/role/function seems similar to me).
iOSWP7Android
"View"XIB (Interface Builder)Xamlaxml
UIViewControllerPhoneApplicationPage (codebehind)Activity
n/a (UIAutoResizing)StackPanelLinearLayout
UITableViewListBoxListView
UITableViewCellListBox.ItemTemplaten/a (any view)
UITableViewSourcen/a (binding, IEnumerable)BaseAdapter
Navigation "Controller"NavigationController. PushViewController()NavigationService.
Navigate()
StartActivity()
n/a (object)Xaml UriIntent.SetClass()
n/a (object properties)Xaml Uri querystring paramsIntent.PutExtra() .AddFlags()
n/a (object properties)NavigationContext
.QueryString
.TryGetValue()
Intent .GetXXXExtra()
ThreadingInvokeOnMainThreadDispatcher.BeginInvokeRunOnUiThread
"Model"C# .NET objects - shared thanks to Mono on iOS & Android. Also WebClient, Linq, Generics, Xml, Serialization, etc... :-)

One major difference between iOS and the other two (both in terms of coding and also UI design) is the presence of hardware buttons and the back-stack.

Hardware buttons
The most important hardware button is Back (covered next) however Android's Menu button is also significant for the impact is has on UI design compared to iOS and WP7. Both Apple and Microsoft's designers like the application menu (UITabBarController, ApplicationBar) to be permanently visible. Google, on the other hand, provides the Menu button to show the menu, meaning that most of the time it is hidden. This means your Android app UI might need to provide other visual clues so that navigation/features/options are more discoverable.

Back stack
Both Android and WindowsPhone7 devices have a hardware Back button supported by the respective SDKs via the 'back-stack' which is analogous to your web-browser History: each "View" has an "address" (a Xaml Uri in WP7, an Intent in Android) which is stored as the user navigates through your application. At any time (unless you intercept it) the hardware Back button allows the user to cycle back through previous views until they have exited your app.

iOS utilises a similar navigation metaphor in its UINavigationController - however the back button is 'soft' (displayed in the top-left corner of the screen) and the scope is limited to the set of views that the developer chose to include in that navigation context.

1 comment:

Note: only a member of this blog may post a comment.