I want to set a button in my Android application that is comprised of text (left aligned), image and another text (right aligned).

Text1, Text2 and image must be customizable from code.
I am a noob in Android development and I only can guess that Text1 and Text2 should be defined as TextView and image should be defined as ImageView. But it is impossible to set them as children to Button because button is not a ViewGroup.
How do I specify it in xml layout file?
Yeah its easy. Place all these component in a single relative layout. Then follow this:
In
TouchListenermethod, you will get a view as a parameter. So you get the id of the view usingIn OnClick method, write your logic, so where ever you perform click on that relative layout your
onclick()method will execute.