Coursera: Cloud Services for Android Handheld Systems

Hello all,

It’s been a while since I last posted on wordpress. I think I have just been so busy at work and with the Coursera course on Cloud Services for Android Handheld Systems. Here are some great threads to read up on if you are also completing the course at the moment:


There Goes Gravity: A Life in Rock and Roll

Kurt von Behrmann's view

A Take on There Goes Gravity: A Life in Rock and Roll

There Goes Gravity There Goes Gravity


By: Kurt von Behrmann

Access is crucial to any journalist. However, acquiring it in the rarefied realm of contemporary music presents special challenges. The biggest obstacle is gaining the trust of musicians, particular those who have achieved stratospheric success. Lisa Robinson had entrée into that world, and all that comes with it, the good, the bad, the ugly and even the boring.

“There Goes Gravity: A Life in Rock and Roll” chronicles Robinson’s encounters with acts that achieved iconic status and those that were seminal in the underground music scene of 70’s in New York. The thrust of the book focuses on her stint as a traveling journalist with the Rolling Stones and Led Zepplin.   Both from the U.K., wildly successful and huge fans of African-American music, their respective tours included the obligatory chartered…

View original post 1,523 more words

Android for Beginners: Booleans

One interesting thing that I have discovered recently is that in java (and in Android), when we declare a boolean as an instance variable in the class without instantiating it, java automatically instantiates it as false. Let’s take a practical example, one that I have encountered recently.

Inside an app, there a boolean instance variable was declared:

public class example {

    private Boolean test;

…do something …


Inside the class, we have an if statement which is driven by the boolean variable that has just been created, in other words, we have the following:

if (test) { …do something …}

But since we never instantiated the test variable, one would assume a nullpointerexception would be returned, since we never instantiated “test”. However, from my research, I found out that booleans are actually primitive types and therefore they cannot be null. Only reference types can be null. 

See the following website for description of the two different types:

  • primitive types are the basic types of data
    • byte, short, int, long, float, double, boolean, char
    • primitive variables store primitive values
  • reference types are any instantiable class as well as arrays
    • String, Scanner, Random, Die, int[], String[], etc.
    • reference variables store addresses

Furthermore, if you do not instantiate booleans, the boolean is automatically instantiated by android to “false”. See the boolean section on the android site and look under the section called constructor:

Therefore our if statement will be skipped as we will have if (test) which is the same as if (false).


Android for Beginners: Coursera

Coursera is one of those absolute gem that I have found indispensible for new android programmers. The courses there are given free of charge by various universities which contribute through making MOOC (Massive Online Open Courses) available to the world so anyone, anywhere, can learn. Coursera really does a wonderful job in making education freely assessible. 

Coursera courses come with video lectures that are dished out on a weekly basis. Watching these videos can take about 1 – 2 hours, depending on the level of proficiency / knowledge you have on the subject. After watching the videos, there are quick quizzes and assignments you can do to test your knowledge. These quizzes and coding assignments which are both graded automatically by the Coursera system. All you need to do is to upload your code onto the site, it grades it for you, and within a few minutes, the system comes back with your marks.

There is also a massive support community on Coursera forums consisting of both students who are doing the course, teaching assistant (TAs) and of course, the lecturer. You can post a question on the forum and within a day, you are almost certain to have your answer. Don’t be scared to ask a question there  – people there are available and willing to help you with your problem and most importantly, people understand where you are coming from as a beginner as they are also in the same boat as you.

I’m currently watching the videos for Programming Cloud Services for Android Handheld System ( Dr Jules White does an excellent job at explaining the basics of HTTP and the communications between the app and the cloud. It is definitely worth a look at.


Beginners: How-To Guide for ImageView’s setSelected() method

In this post I will discuss with the setSelected method from the ImageView class. Documentation for this class can be found here: .

In the WordPress android app, we see setSelected method in action as each time you touch the comment button to leave a comment in a post, the comment button turns from blue to orange. If you click on the orange comment button, it becomes blue again. 

This transition from one colour to another is actually completed using a very simple piece of android code. Firstly, we need to gets a references to the imgBtnComment (which is the blue comment button).

final ImageView imgBtnComment = (ImageView) getView().findViewById(;

Once you have that, you can use the line below to switch from the blue comment button to orange comment button once an event has occurred, such as a touch on the button, typically detected through the use of a listener. We use the following setSelected method code for the ImageView:


This will then tell android to use the orange comment button image as we are setting the setSelected to true and so it will look for the associated drawable with the attribute called “state_selected” . See xml for the drawable below:

<?xml version=”1.0″ encoding=”utf-8″?>
<selector xmlns:android=””&gt;

<item android:drawable=”@drawable/ic_comment_active” android:state_pressed=”true”/>
<item android:drawable=”@drawable/ic_comment_active” android:state_selected=”true”/>
<item android:drawable=”@drawable/ic_comment”/>


From the above, you can see that there are two drawables defined. One is for either “state_pressed” and “state_selected” and the other is the normal blue comment button / the one that is displayed when no one has touched it – therefore it is not “active”.

If you want it the imageView to appear as a blue comment button, you can use the following setSelected code:


Your comment button should now be blue.


Android for Beginners

If you browse the internet for android coding stuff, you will find a ton of documentation written in high-level gobblegobble that sometimes doesn’t make a lot of sense.

That’s probably because android docs and tutorials, for example, even on the authoritative site, are more targeted at seasoned coders and not really for our mild beginners. Sometimes, you just need someone to do some translation for you on some of the methods android offers so that a beginner, like yourself (and myself, to an extent), can understand.

In the last 8 months where I have been learning android myself, I have made a lot of headway in understanding the code. I have also completed a coursera course on Programming Mobile Applications on Android Handheld Systems which ended in April 2014 and passed that with flying colours.

In the next few posts, I want to share my discoveries with the rest of the world and with all you lovely readers 🙂 – on what I have discovered on my Android Adventures. These posts will be written at a basic level so that beginners can gain a basic understanding of the concepts inside the vast system of Android.

Stay tuned for my Beginners: How-To Guide to Android.


Open-Sourced Android

Exploring what you can do with android has becoming quite a hobby for me. I love seeing how developers program android apps and how all the classes pull together to generate that polished finish product.

As a tech guru from another blog recently said, to code well you need to first read and understand good code. I think I have taken that to heart and I have been trolling the internet on the beast that is google, constantly on the lookout for open-sourced code.

For all your beginner android programmers / hobbyist and the seasoned android veterans, one indispensible resource to have is where open-source developers develop their apps and then upload for people to evaluate. There are some great example apps there and a would-be programmer can definitely learn a lot.

A quick flip through the categories of open-sourced apps on f-droid reveals some real gems hiding away in between the mass of apps. There are open-sourced apps for messaging (“Telegram” which bears a striking resemblance to Whatsapp), for internet browsing (“Lightning”) and even blogging (“WordPress”). These apps are professionally developed and feels like something one would actually pay for – thank goodness for open-source!:)

Do you know of any other great open-sourced apps which are great for learning how to code for android? Let us know by leaving a comment below.