Sunday, November 10, 2013

Android performClick on random button [android help]


Android performClick on random button



I need to do performClick() method on random button. Getting NullPointerException



final Button[] buttons = {bt1, bt2, bt3, bt4, bt5, bt6, bt7, bt8, bt9};

bt1.setOnClickListener(new View.OnClickListener() {

public void onClick(View p1)
{
// TODO: Implement this method

int rando = (int) (Math.random()*9);
Button randombutton = (buttons[rando]);
randombutton.performClick();
}

});


Read more

stackoverflow.comm



No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...