Can i use multiple OnClick() function in one code??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Aradhya
    New Member
    • Sep 2013
    • 1

    Can i use multiple OnClick() function in one code??

    i am making an android app .I am just a beginner. can someone tell me if i can use more than one OnClick() in my code. As i need to perform specific tasks on each button click.
  • Nepomuk
    Recognized Expert Specialist
    • Aug 2007
    • 3111

    #2
    Hello Aradhya and welcome to bytes.com!

    In Android programming, every button (in fact everything that extends a View) can have an OnClickListener which you can set with the setOnClickListe ner(OnClickList ener) function. Look at the first example on the Button api reference, that gives you an idea of how to set OnClickListener s via Java or the second and third code blocks for how to set one via XML. So yes, you can have many, many OnClick methods. :-)

    Comment

    Working...