I'm trying to get a better understanding of the Android framework and therefore I've created a simple App, which actually consists of just one Button. Whenever this button gets clicked, a method called sendMessage
in the MainActivity
starts a new activity DisplayMessageActivity
, which displays a random string.
My question now is, how does the onClick
Event of a button (defined in the XML
layout) work in particular?! I do understand, that whenever I click my button, the method, which i defined (android:onClick="sendMessage"
) gets called, but I'm really curious which method calls my method in the end, because there is obviously no call of my method in the syntax.
I've already decompiled my APK File to smalicode using androguard and searched for invokes of my sendMessage
method. Unfortunatly i couldnt find anything.
Can anyone explain me how this mechanism functions, because according to this post:
How exactly does the android:onClick XML attribute differ from setOnClickListener?
there should actually be a method, which calls my onClick
method in the end.