Code example for Button

Methods: setEnabled

0
  protected void onActivityResult(int requestCode, int resultCode,
                                  Intent data) {
    if (requestCode == PICK_REQUEST) {
      if (resultCode == RESULT_OK) {
        contact=data.getData();
        viewButton.setEnabled(true);
      } 
    } 
  } 
 
  public void pickContact(View v) {
    Intent i=
        new Intent(Intent.ACTION_PICK,
                   ContactsContract.Contacts.CONTENT_URI);
 
    startActivityForResult(i, PICK_REQUEST);
  } 
 
  public void viewContact(View v) {
    startActivity(new Intent(Intent.ACTION_VIEW, contact));