Month: April 2013

Ok so this has to be among the silliest UI “innovations” I’ve encountered.

After updating my phone, Samsung Galaxy Nexus, to Android 4.2.2, I could no longer find the Developer Options menu. And here’s why … Google seems to have decided to no longer make that menu visible by default.

We can argue over why they made such a change ( my guess is to make the developer options less accessible to non-devs ) … but whatever the reason, it’s a pain.

So how to get it back ? (you’re not gonna believe this) …

Open your settings menu

Scroll down and select “About phone”

Locate the entry labeled “Build number’ (probably near the bottom)

Tap repeatedly (I believe its 7 times) on the “Build number” entry (I’m not making this up)

As you do you’ll eventually see a message something like “You are now X steps from being a developer” … continue to tap until the “Developer Options” menu become visible.

And now you have your “Developer Options” menu back … it’ll appear on the Settings menu (screen just prior to reaching the screen with the “Build number” value)

I spend most of my time creating Android apps using Java and the Android SDK. That’s a development style that fits my experience and interests.

There are lots of developers out there who have great skills in web-based technologies like HTML, JavaScript and CSS; many of those developers are looking to start creating mobile apps. The good news is that there’s a now a solution for just those developers.

Fellow Pluralsight author, Shawn Wildermuth just created a course for just those folks: Practical PhoneGap. It doesn’t completely replace traditional mobile app development but does work well in a number of situations. Here’s the description from the Pluralsight website…

App development is crucial to succeeding in most jobs these days. Even if you aren’t building apps directly, you’ll likely be involved in the app development process. In this course, we’ll show you how you can use existing HTML, JavaScript and CSS skills and assets to build mobile apps using their simple model. We’ll also show you when you wouldn’t want to use PhoneGap and where it fits into most developers bag of tricks

Still have some more work to do editing the videos, preparing the course assessments, etc. but the hard work is done.

I have to say, this has been one of the most fun courses to write I’ve done. There’s something cool about taking control of the camera, rendering the live preview directly within one’s app View hierarchy and snapping a picture or recording a video.

Something I had thought was going to be a minor point that I ultimately found really interesting was controlling zoom.

The basic zoom-in/zoom-out stuff was just the beginning. Controlling the out-of-band smooth zoom and managing the callbacks that occur during the zoom process were really fun.

The course also ended having much more information than I had originally expected. I had originally spec’d the course out for 5 modules but ended up with 7 jam-packed modules – here they are…

Getting Started

Directly Accessing the Camera

Viewing the Camera Preview Display

Taking a Picture

Camera Control

Recording Video

Media Store

If all goes as expected, I’ll have everything turned in to Pluralsight early next week and the course will be live a short time later. I’ll be sure to let everyone know when it goes live.

A challenge commonly faced when first developing in Android is the potentially frequent destruction and reconstruction of an Activity. The most common time this occurs is when the user rotates the device between horizontal and portrait orientations.

Many an app that runs fine during testing suddenly crashes when put into a user’s hands simply because the user tilted the device one way or another.

This crashing usually occurs because device orientation changes cause the Android framework to tear down the displayed Activity along within any contained Views, and then to fully reconstruct the Activity/View hierarchy. Any references to the Activity or to the Views within the Activity suddenly become invalid. Similarly any references within the Activity or Views that were set as a result of a user action or similar are now lost.

There are a number of ways to deal with this issue but one of the easiest is to take advantage of Fragments.

NOTE: You can use the configChanges attribute on your Activity’s manifest entry to prevent the teardown/reconstruction process caused by orientation changes but that has its own headaches.

Fragments won’t automatically resolve this issue because, by default, when the Activity is torn-down in response to an orientation change the Fragment contained within the Activity is also torn down along with any contained Views.

The solution lies in an underused method: Fragment.setRetainInstance.

Calling setRetainInstance with a value of true causes Android to preserve the Fragment across the teardown/reconstruction cycle of an Activity. Along with the Fragment, the Views or other object references contained within the Fragment or Views remain.

With setRetainInstance(true) called on a Fragment instance … when an orientation change occurs, Android…

Something to keep in mind though … because your Fragment instance will be moved between different Activity instances, you should avoid caching a reference to the Activity. Instead call Fragment.getActivity anytime you need to reference the Activity.

Note: Beginning in April, 2013, these charts are now built using data collected from each device when the user visits the Google Play Store. Previously, the data was collected when the device simply checked-in to Google servers. We believe the new data more accurately reflects those users who are most engaged in the Android and Google Play ecosystem.

So basically .. they now count devices that actually attach to Google Play rather than counting every single device that just happens to wake up periodically and send a heartbeat to the Google servers.

So the cynic might say that Google is skewing things for their own advantage (I’m not saying they’re unhappy with this new way of counting) but I don’t really think that’s the case here.

Honestly, most of us looking at those charts are interested in seeing what versions of the platform we should target with our apps. Those apps are distributed via Google Play … so, I agree that this is the “right way” to count.