Skip to content Skip to sidebar Skip to footer

How Do I Do SetOnClickListener In Fragment

Please i'm noob in android,i just have been assigned a task and i need to finish it in two days, I need to set Onclicklistener(this),i received a code from someone,and i had to mak

Solution 1:

You can initialize a new onClickListener in for loop.

for(int i=0;i<sortableHeaderWrappers.length;i++)
    {
        sortableHeaderWrappers[i].setTag((Integer)i);
        sortableHeaderWrappers[i].setOnClickListener(new View.OnClickListener(){
 @Override
  public void onClick(View v) {
                //.. place your logic that needs to be executed when click happens. 
   }
})
    }

Post a Comment for "How Do I Do SetOnClickListener In Fragment"