Suppose you have five question. when he reached the last question. He definetly submit or click next. on that just pass a boolean variable in Intent if it is in an other Activity.
Intent intent = new Intent(CurrentActivity.this,Destination.class);
intent.putExtra("flag",true/False);
startActivity(intent);
getting intent in another activity..
boolean flag = getIntent.getExtra().getBoolean("flag");
if(flag)
// button.setEnabled(false);
else
// do other stuff
// to send and recieve boolean
Set intent extra:
Intent intent = new Intent(this, NextActivity.class);
intent.putExtras("yourBoolName", true);
Retrieve intent extra:
@Override
protected void onCreate(Bundle savedInstanceState) {
Boolean yourBool = getIntent().getExtras().getBoolean("yourBoolName");
}
2
solved Button a button unclickabale in Android