title: Focus removed while typing in edit text
body: <p>I have an <code>EditText</code></p>
  
  <pre><code>serialText = (EditText) findViewById(R.id.pinText);
  </code></pre>
  
  <p>Now onclick of somebutton, I should get the focus to edit text to write something. But when I click inside of edit text to write, focus is getting removed, i.e., whatever i type does not appear in the edit text</p>
  
  <p>This is the code to do that,</p>
  
  <pre><code>public void method(View v) {
  
  
  arrowButton.setOnClickListener(new OnClickListener() {
  
  
  @Override
  
  public void onClick(View v) {
  
      serialNumber = serialText.getText().toString();
  
          if (serialNumber.equals("")) {
       } else {
  
  
  }
  
  
  } }...
  </code></pre>
  
  <p>Here if I don't type anything it comes to if loop without any problem, but samething is not happening for else part.</p>
  
  <p>Can you please help me?</p>
  
  <p>This is my full code</p>
  
  <pre><code>public void onClick(View v) {
  
      if (v.getId() == R.id.pinBtn) {
  
          arrowButton = (Button) findViewById(R.id.arrowBtn);
  
          serialText = (EditText) findViewById(R.id.pinText);
          serialText.setVisibility(View.VISIBLE);
          arrowButton.setVisibility(View.VISIBLE);
          //serialNumber = serialText.getText().toString();
          arrowButton.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  serialNumber = serialText.getText().toString();
                  if (serialNumber.equals("")) {
                      Toast.makeText(getApplicationContext(),
                              "Please enter the serial number",
                              Toast.LENGTH_SHORT).show();
                  }
                  else {
  
                      isRegularSerialNumber(serialNumber);
  
                      String encodedserialNumber = Base64.encodeToString(
                              serialNumber.getBytes(), Base64.DEFAULT);
  
                      receiveSerialData(encodedserialNumber);
  
                      if (serialResponse.equals("Validated Successfully!")) {
                          showAudio(v);
                      } else {
                          Toast.makeText(getApplicationContext(),
                                  "Invalid Serial Number", Toast.LENGTH_SHORT)
                                  .show();
                      }
                  }
              }
          });
      }
  }
  </code></pre>
  
  <p>Thanks</p>