I have a problem, I want to disable a button in onCreate method, please share the way of disabling any button at runtime in onCreate method.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_requests_interface);
Intent intent = new Intent(this, AdminPopup.class);
startActivity(intent);
String fName = getIntent().getStringExtra("fName");
TextView tfName = (TextView)findViewById(R.id.fName);
tfName.setText(fName);
String vuEmail = getIntent().getStringExtra("VUEmail");
TextView tEmail = (TextView)findViewById(R.id.vuEmail);
tEmail.setText(vuEmail);
EditText vuEmailTest = (EditText)findViewById(R.id.vuEmail);
String email = vuEmailTest.getText().toString();
String str = email.substring(0,2);
if(str.equals("bc")){
String str2 = email.substring(3,9);
boolean digitsOnly = TextUtils.isDigitsOnly(str2);
if (digitsOnly){
Button accButton = (Button)findViewById(R.id.accButton);
}
}
else{
Button accButton = (Button)findViewById(R.id.accButton);
}
}
Button button =(Button) findViewById(R.id.buttonid); button.setVisibility(View.GONE);