Although it's been a long time, thought it might help others who have this problem, it took me many trials to get it right. But i think what finally solved my problem was setting the clickable attribute of a button in the layout's xml to true.
Code sample:
<Button android:text="Button" android:id="@+id/button1"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:clickable="true">
</Button>
Further, if you would've looked at the DDMS perspective, you would've seen that the cause of the error was NullPointerException, which ofcourse was showing because clickable wasn't set. Correct me if i am wrong.