Home Features Current 10 things every Android developer needs to know - 7. Form factors
10 things every Android developer needs to know - 7. Form factors
Written by Carl Whalley   
Friday, 20 November 2009 09:00
Article Index
10 things every Android developer needs to know
1. Support
2. An IDE
3. Java
4. Graphic design
5. XML layouts
6. The Market
2. An IDE
8. OS Versions
9. The App Lifecycle
10. DDMS
All Pages

7. Form factors

Tame that fragmentation beast.

J2ME was touted as Java in every handset - and that's pretty much what it became in the end. To achieve this across such a diverse range of devices, compromises had to be made. Most now accept those compromises were too limiting, meaning you had built a car with 1 gear, only available in black with 1 seat which could onlfy travel on the freeway. Manufacturers wanted to sell more handsets ;-) They "enhanced" the standard J2ME with their own extensions, which was great for them but very, very bad for the ecosystem as a whole. Apps which used proprietary extensions were not compatible, resulting in its ultimate demise.

Android is so much richer than J2ME it's off the scale, but those pesky manufacturers will insist on trying to differentiate their products. There's a risk that this fragmentation could happen again, and we could end up in the nightmare situation of having to develop and market apps for each Android device. To be fair, the closed guys have their faults but this isn't one of them. Heres Googles take on the issue:

 

 

So what can Android developers do about it? As it happens, it's nothing like as bad as J2ME. When you think of different form factors you have the obvious one, with or without a keyboard, and then the usual culprits such as screen pixel density, memory capability, cpu power, sensor support and so on. There are some obvious pitfalls to avoid, like hardcoding absolute values in your XML layouts, and some rules to stick by such as always using density-independent pixels ("dip" or "dp") and scale-independent values ("sip" or "sp").

There are really only 3 screen size to sizes to target, and support is built in as explained here. Basically, your code can interrogate its environment at start-up to detect the presence/absence of essential hardware features, so your GPS app should fail gracefully with an error message if location isn't supported, and that's all done in one app.



 

Comments  

 
0 #5 cousinHub 2009-12-10 06:54
I liked this part in part 8 (OS versions):

Android releases are named after desserts, so we had Cupcake (1.5), Donut (1.6) and Eclair (2.0), the next two are rumoured to be Flan and Gateaux - in case you hadn't spotted it, there's an alphabetic progression there
Quote
 
 
0 #4 Robert Lilly 2009-12-09 16:26
Awesome article. Now I'm really glad I learned to develop on Android for my augmented reality app instead of some other mobile system. And today I'm going to an interview for an Android developer position.
Quote
 
 
0 #3 Matt Kanninen 2009-12-04 01:32
Preach it brother!
Quote
 
 
0 #2 André 2009-11-24 06:31
Thanks for this article :) I'm sure this will help a lot of Android fans to start their own little project.

For graphics I'm a fan of Inkscape now. It's an awesome piece of software. Especially for doing games and similar stuff. All graphics of my own game Puzzle Blox have been created with Inkscape. Thumbs up!
Quote
 
 
+2 #1 Jeff Watson 2009-11-20 22:10
Great article. I found item #8 Dalvik Debug Monitor Server very useful!
Quote
 

Add comment


Security code
Refresh


Copyright © 2010 Android Academy. All Rights Reserved. Privacy statement. Sitemap.
Android Academy is not associated with Google in any way. All trademarks acknowledged.