Firing diffrent listener


Last Updated:

  1. Leela krishna

    Leela krishna Member This Topic's Starter

    Joined:
    Sep 8, 2009
    Messages:
    10
    Likes Received:
    0
    i have created 4 buttons and listeners
    then if i press one button it fires another button,s listener
    help me
     

    Advertisement
  2. jksharma

    jksharma New Member

    Joined:
    Oct 15, 2009
    Messages:
    4
    Likes Received:
    0
    Make one listener class implementing OnClickListener and set this listener to all buttons and then in OnClick(View v) implement all logic performed on click event.

    you can get reference of resource id of button by
    v.getId()
    then compare it to all buttons

    if(v.getId()==R.id.button1)

    then write logic which you want to perform when button1 is clicked.
    make sure all buttons have different ids by layout xml.
     

Share This Page

Loading...