In this edition of Ask a Developer we were lucky enough to get the chance to hear from Mark Murphy. Mark Murphy is the founder of CommonsWare and the author of “The Busy Coder’s Guide to Advanced Android Development” and other books on Android application development.
Android’s latest version, Jelly Bean, has been a highly publicized and talked about product. What is your favorite new feature that has been added in the latest Android release?
Long-term, I suspect that I will most relish the secondary screen support, particularly considering the number of presentations that I deliver.
Right now, though, I am happiest about the change in the ContentProvider behavior, so that it is private (non-exported) by default. I would not be surprised if there are 10,000+ apps out on the Play Store that fail to adequately secure what developers thought were
private ContentProviders. The updated Lint rules to complain about this helped some, but the change in the default will still be a significant benefit for user privacy and security.
Even though Android has been around for a few years now, it is still a ‘youngen’ in the programming world. What kind of recommendations would you have for someone starting out in Android?
Make sure that you are reasonably comfortable with Java before diving too much into standard Android development. Learning a programming language and an OS/API set at the same time can be rather daunting. I posted a list of Java topics that all Android developers need to know a couple of years ago, and the list is still fairly accurate:
However, that “couple of years ago” point is itself important. Android is a swiftly moving target. Make sure that the resources you are using are up to date. Blog posts and the like from 2008 and 2009 may still have good advice, but may well be dated.
Stack Overflow has become a beacon for programmers since its launch in 2008. What has drawn you to Stack Overflow?
For the focused purpose of programming questions and answers, it’s an awesome tool. Syntax highlighting, decent notification options, a strong culture to beat back spammers, and the like do wonders to help keep the quality up. The fact that you can ask questions without initial moderation — unlike with most Google Groups, like android-developers — also helps lower the barriers to participation.
What are a few tips that you have for Android programmers using Stack Overflow?
- If your code is crashing, take a look at the stack trace in LogCat. Do not just post “my code doesn’t work” to Stack Overflow an expect an answer. If you cannot make sense of what the stack trace is telling you, post it and the relevant portions of source code in your question, otherwise it may be very difficult to get help.
- Read other questions and answers, not only as part of your research about your problem, but to see what works and what doesn’t. For example, extremely short (e.g., 20 or fewer words) and extremely long (e.g., several pages of scrolling in a browser) questions tend to get fewer answers, in my experience.
- Pictures may not be worth a thousand words, but screenshots can be very helpful in diagnosing your problem, particularly if your issue is in trying to get your GUI to render as you want.
- Patience is a virtue. While most Android questions will get answers within the first hour, it’s no guarantee. Do not panic right away. If, however, your question has no answers after a day or two, try to improve the question, and then post a bounty (if you have the reputation points for it) to try to get renewed attention on your issue.
The open source nature of Android has lent itself to help cultivate a community of the same mindset. That community has helped birth many different open source libraries and plugins for Android. Which is your favorite third party library for Android?
ActionBarSherlock. The work that went into that must have been epic, and it’s astonishingly solid at this point. Jake Wharton belongs on the Mt. Rushmore of Android engineers.
What is a feature in Android that you feel is underused? Where would you recommend to make better use of that feature?
While it is not strictly an individual “feature”, I feel that developers would be better served trying to use a plugin-based deployment model in many cases, particularly where you are asking for too many permissions. Long lists of permissions scare off many a prospective user. Ideally, the core features of your app use relatively few permissions, with niche features perhaps requiring the rest. In cases like that, isolating those niche features into separately-installable plugins, securely communicating back to your main app, can reduce the number of permissions the main app has to ask for. In an ideal world, stock Android would offer users more flexibility to disable individual permissions themselves — until and unless that is added, plugins are the next-best option for app developers to deliver capabilities while not asking for too many permissions up front.
You can find out more about Mark Murphy