Live data from Hacker News

Android Development Tips For iOS Devs

stuartkhall.com

1–10 of 78 posts

Re: Android Development Tips For iOS Devs

#3
"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."

With its "native" emulator, yes, but there are better alternatives like Genymotion. Giving up on them is not good development advice.

Re: Android Development Tips For iOS Devs

#4
"A trick often used by iOS devs is to use the tag of a view to hold lookup information, such as offset in arrays. With Android you can shove the entire object into the tag; pretty useful."

Yes, but if it's something like a ListView, don't put offset in array there, because the views are recycled (when user scrols), so you're likely to end up with corrupted data. I got bitten by this in the beginning. You can go to great lengths to prevent this from happening, but it will be hard for a reason, because that's abusing the design principles.

I'd recommend reading up on the ViewHolder pattern in this context.

Long story short: cache all the references to all specific sub-views of the row view in the tag (so you don't have to retrieve them again and again) - that's good practice. Just don't store any position-specific data in it.

Watch http://youtu.be/wDBM6wVEO70?t=9m50s - very informative

Re: Android Development Tips For iOS Devs

#6
post #5

You can get a pretty responsive emulator if you use an x86 ABI and HAXM[0]. [0] http://software.intel.com/en-us/android/articles/intel-hardw...

Having used both the iOS simulator and the Android emulator, I don't really see why people continue to complain. There are even x86 images for the Google APIs and at least on my MacBook with that the emulator feels comparably snappy.

Re: Android Development Tips For iOS Devs

#9
Some things I would note:

* Do not use getBaseContext() like he does when he created the new Activity. Use getApplicationContext for most things (unless an Activity is required) as this is guaranteed to be the same throughout the lifetime of your application.

* For log alternatives, checkout Timber by Jake Wharton (https://github.com/JakeWharton/timber)

* I would suggest using the Build.VERSION_CODES when making the check against which version of android the device is (http://developer.android.com/reference/android/os/Build.VERS...)

Re: Android Development Tips For iOS Devs

#10
post #5

You can get a pretty responsive emulator if you use an x86 ABI and HAXM[0]. [0] http://software.intel.com/en-us/android/articles/intel-hardw...

You will get a faster emulator, but since x86 is used on like sub 1 percent Android devices, won't that be more like using a simulator, which would make it just as useless/useful as a simulator? Does the x86 image contain support for ARM, too?
Post reply on HN