I have same code in two methods still when I click respective button, the code executes (including finish()), but when I call other method from code it does not. Can someone explain why? How to execute this code without the button's onClick?
@Override
public void onClick(View view) {
    Intent data = new Intent();
    data.putExtra("name", "Adnan");
    setResult(2, data);
    finish();
}
public void qoIntentin(){
    Intent data = new Intent();
    data.putExtra("name", "Adnan");
    setResult(2, data);
    finish();
}
 
     
    