Code to click button programatically without user interaction,Android

loginBtn=(Button)findViewById(R.id.loginBtn);
loginBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
validateLogin(v);
}
});

//use this below line, it will click your button programatically whenever and wherever you want..
loginBtn.performClick();

Comments

Popular posts from this blog

Custom Dialog with no title and full screen in Android

code to display .pdf,.text,.DOC,.DOCX,.doc extension files exists in SDCard

Best working code to set Date limits on Date Picker Dialog,in Android