Thinking Aloud
Experiment with Android

So today`s post is about my first experiment with android development. Its like they say “The best way to learn is to do it yourself” or “The first step is the most hard to take” or in my words “to be the best, you have to pass through good and better first”.

Coming to the app and what i went through. The app is as simple as it can be, A Facebook album viewer for you and your friends. Easy to start with, it allowed me to learn two things, Android app development and Facebook SDK for android. Lets talk about each of them.

Android: Oh My, if you have tried your hands on iOS development, it might not be so easy to just switch. The first and the easiest part in iOS is to create your views. You start the Interface Builder and its just drag and drop, as easy as it sounds (well for simple apps atleast). But in android, the drag and drop thing doesnt work as simply, you have to write most of the things in the xml file manually. That`s a pain. And doing it for all the activities takes a lot out of you.

After that things are a lot simpler and similar to the way you code anything mobile. There are lot of view available and you can use any number of them on a single activity. You can hide the not needed ones, create views on fly or remove them. If you are down with the UI, its more about the concept then the code.

A simple UI View can look like this with some image, some button and some text

And a bit more complex can look like this: an image, multiple texts, gallery view, list view.

It takes time to get used to the way Activities behave, how to navigate between them, how to communicate between them. This was the second problem i faced. Once you figure this one out, the concept of adding view becomes simple. I actually became so comfortable that i added multiple new views against my earlier mocks.

Next problem i faced was how to let views interact with each other. What if you want one view to be updated if some changes are made to some other view? This is actually very simple using adapters (notifydatasetchanged() method)and comes in very handy to improve your user experience. In this activity, i was changing the gallery view if the list view changed, and changing the list view if the gallery view changed.

You need to remember, views and activities are two different things. An activity can contain any number of views. And a view can be used as an activity.

You can go through the code at https://github.com/maheshgattani/DownloadFacebook

Now the Facebook SDK. Man o Man, this is the reason Facebook can never be the next Orkut. They just made it so simple for developers. Now its not only Facebook people working for them, they have people like me also. Its just the simplest thing. Go to Facebook Developers page, setup a test app, get an app ID, download the SDK, and you can start writing code. The first thing i figured when i started writing this app was Facebook SDK is the least of my worries, because its just so simple and easy to use. and what more, Facebook has provided tools to test a few things while you are working on them.