Sunday, January 15, 2012

Android: First Encounters (newbie guide)

Yesterday I have finally found some time to start learning native Android development. I must admit that the official Android documentation is very good and the learning curve so far was pretty low. That being said, I am not a total newbie when it comes to mobile development - after all, I've done it in J2ME, WebOS and even on Android (but using PhoneGap, admittedly). Still, a new framework is a new framework and when it comes to learning, Android is definitely user-friendly.

Pros:
  • Nice Eclipse plugin
  • Visual GUI designer
  • Good documentation
  • Lots of tutorials available due to it being a "hot topic" nowadays
Cons:
  • The plugin is sometimes a little faulty (the app was sometimes getting stuck on "Waiting for debugger" message and I had to restart Eclipse)
  • The emulator is kind of slow (I found WebOS emulator to be much better)

Instead of writing yet another Hello World Android tutorial myself, I have decided to gather all the links to documentation and tutorials I went through while learning yesterday and put them in the order in which I believe it is most beneficial to read them. If you are also starting with Android, I hope this will be of use to you (it is very basic things, though):

  1. http://developer.android.com/resources/tutorials/hello-world.html
    Classic "Hello World" tutorial. Great primer to get your first Android app running.
  2. http://developer.android.com/resources/tutorials/views/index.html
    If you are just starting, just take a look at this to know what layouts you have available; read it only when you really need a given layout.
  3. http://developer.android.com/resources/tutorials/localization/index.html
    Follow this tutorial to get your feet wet with how Android handles resources. You will need it for pretty much every application.
  4. http://developer.android.com/guide/topics/fundamentals.html
    Time for some theory. Read to get more in-depth knowledge of what the basic Android building blocks are.
  5. http://hacksoflife.blogspot.com/2011/02/losing-javadocs-in-eclipse-solution.html
    Useful if you are unable to access Android JavaDocs in Eclipse; you will certainly want to connect them to the IDE sooner or later, may as well do it sooner.
  6. http://developer.android.com/guide/topics/fundamentals/activities.html
    A must read, so you know what Activities really are and what can you do with them.
  7. Now go and modify the Localization example so that clicking on the flag opens Contact List activity, allowing the user to select a contact (what you have just read describes how to do it using an implicit Intent). Display that selected contact's name in the popup that normally appears after clicking the flag. You will need to give your application a correct permission so it can read contact data.
  8. http://developer.android.com/guide/topics/fundamentals/tasks-and-back-stack.html
    Some advanced Activity topics. Don't think you need to completely read it now, just browse through it.
  9. http://developer.android.com/guide/topics/fundamentals/services.html
    Just browse so that you know what Services are and what you can use them for. Come back and read it when you actually want to implement or use one.
  10. http://developer.android.com/guide/topics/providers/content-providers.html
    A must read. Learn what Content Providers are (you already used one when implementing the app in point #7, now broaden your knowledge).
  11. Implement your own ListView (consult point #2 on how) and make it directly read and display the Contacts available in your phone.
  12. http://xjaphx.wordpress.com/2011/06/19/create-and-use-custom-content-provider/
    Read on how to implement your own Content Provider using SQLite. Implement one and change your ListView to query it instead of Contacts.
  13. http://stackoverflow.com/questions/2808632/manually-put-files-to-android-emulator-sd-card
    You will want to be able to access your SQLite db directly (outside of Android) sooner or later. Here's how you can access the Emulator's filesystem to do it (the database itself is by default placed in /data/data/<your app id>/databases)

That's all the resources I have gone through so far; going to read on it more now and probably implement something a little more complex. As always, if you have any suggestions on other must-read for Android newbie developers, please drop a comment and I will modify this list.

No comments:

Post a Comment