title: isEmpty() always returning true
body: <p>I was making a form on android. While checking for the text fields, I used isEmpty() method to check if there was any text. The problem is, it is always returning true. I'm unable to figure out where I went wrong. Thanks in advance! :)
  <br><br>If any other file is needed, please comment here, I'll add it ASAP.</p>
  
  <p><strong>AddQuestionActivity.java</strong>
  <br></p>
  
  <pre><code>import static chipset.quizzy.questionadder.resources.Constants.KEY_QUESTION;
  import static chipset.quizzy.questionadder.resources.Constants.KEY_QUESTION_ANSWER;
  import static chipset.quizzy.questionadder.resources.Constants.KEY_QUESTION_HINT;
  import static chipset.quizzy.questionadder.resources.Constants.KEY_QUESTION_NUMBER;
  import android.app.Activity;
  import android.app.AlertDialog;
  import android.content.Intent;
  import android.database.Cursor;
  import android.graphics.BitmapFactory;
  import android.net.Uri;
  import android.os.Bundle;
  import android.provider.MediaStore;
  import android.util.Log;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.ImageView;
  import android.widget.Toast;
  import chipset.quizzy.questionadder.R;
  import chipset.quizzy.questionadder.resources.Functions;
  import chipset.quizzy.questionadder.resources.ShowImageActivity;
  
  public class AddQuestionActivity extends Activity {
  
      Functions functions = new Functions();
  
      EditText addQuestionNumber, addQuestion, addQuestionAnswer,
              addQuestionHint;
      Button addQuestionImage, addQuestionAdd;
      ImageView addQuestionImageView;
      private static int RESULT_LOAD_IMAGE = 1;
      String picturePath, question, questionNumber, questionAnswer, questionHint;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_add_question);
  
          getActionBar().setHomeButtonEnabled(true);
          getActionBar().setDisplayHomeAsUpEnabled(true);
  
          addQuestionNumber = (EditText) findViewById(R.id.addQuestionNumber);
          addQuestion = (EditText) findViewById(R.id.addQuestion);
          addQuestionAnswer = (EditText) findViewById(R.id.addQuestionAnswer);
          addQuestionHint = (EditText) findViewById(R.id.addQuestionHint);
          addQuestionImage = (Button) findViewById(R.id.addQuestionImage);
          addQuestionImageView = (ImageView) findViewById(R.id.addQuestionImageView);
          addQuestionAdd = (Button) findViewById(R.id.addQuestionAdd);
  
          questionNumber = addQuestionNumber.getText().toString().trim();
          question = addQuestion.getText().toString().trim();
          questionAnswer = addQuestionAnswer.getText().toString().trim();
          questionHint = addQuestionHint.getText().toString().trim();
  
          addQuestionAdd.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
  
                  functions.hideKeyboard(getApplicationContext(),
                          getCurrentFocus());
                  if (functions.isConnected(getApplicationContext())) {
                      if (questionNumber.isEmpty() || question.isEmpty()
                              || questionAnswer.isEmpty()
                              || questionHint.isEmpty()) {
                          Toast.makeText(getApplicationContext(),
                                  "Enter All Fields", Toast.LENGTH_SHORT).show();
                          Log.i(KEY_QUESTION, String.valueOf(question.isEmpty()));
                          Log.i(KEY_QUESTION_ANSWER,
                                  String.valueOf(questionAnswer.isEmpty()));
                          Log.i(KEY_QUESTION_HINT,
                                  String.valueOf(questionHint.isEmpty()));
                          Log.i(KEY_QUESTION_NUMBER,
                                  String.valueOf(questionNumber.isEmpty()));
                      } else {
                          AlertDialog.Builder builder = new AlertDialog.Builder(
                                  AddQuestionActivity.this);
                          builder.setTitle("Information");
                          builder.setMessage(KEY_QUESTION_NUMBER + " : "
                                  + questionNumber + "\n" + KEY_QUESTION + " : "
                                  + question + "\n" + KEY_QUESTION_ANSWER + " : "
                                  + questionAnswer + "\n" + KEY_QUESTION_HINT
                                  + " : " + questionHint + "\n");
                          builder.setNeutralButton(android.R.string.ok, null);
                          builder.create();
                          builder.show();
                      }
                  } else {
                      Toast.makeText(getApplicationContext(),
                              "No Internet Connection", Toast.LENGTH_SHORT)
                              .show();
                  }
              }
          });
  
          addQuestionImage.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  Intent addImage = new Intent(
                          Intent.ACTION_PICK,
                          android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
  
                  startActivityForResult(addImage, RESULT_LOAD_IMAGE);
  
              }
          });
  
          addQuestionImageView.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View arg0) {
                  Intent loadBigImage = new Intent(getApplication(),
                          ShowImageActivity.class);
                  loadBigImage.putExtra("picturePath", picturePath);
                  startActivity(loadBigImage);
              }
          });
  
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
  
          if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK
                  &amp;&amp; null != data) {
              Uri selectedImage = data.getData();
              String[] filePathColumn = { MediaStore.Images.Media.DATA };
  
              Cursor cursor = getContentResolver().query(selectedImage,
                      filePathColumn, null, null, null);
              cursor.moveToFirst();
  
              int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
              picturePath = cursor.getString(columnIndex);
              cursor.close();
  
              addQuestionImageView.setVisibility(View.VISIBLE);
              addQuestionImageView.setImageBitmap(BitmapFactory
                      .decodeFile(picturePath));
  
          }
  
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
  
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
          if (id == R.id.action_logout) {
  
              functions.logout(getApplication(), getApplicationContext());
  
          } else if (id == android.R.id.home) {
              onBackPressed();
          }
          return super.onOptionsItemSelected(item);
      }
  
  }
  </code></pre>
  
  <p><br><strong>activity_add_question.xml</strong></p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/turquoize" &gt;
  
      &lt;TextView
          android:id="@+id/addTitle"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentTop="true"
          android:layout_centerHorizontal="true"
          android:layout_marginTop="20dp"
          android:fontFamily="sans-serif-light"
          android:gravity="center_horizontal|center_vertical"
          android:text="@string/app_name"
          android:textColor="@color/clouds"
          android:textSize="30sp" /&gt;
  
      &lt;ScrollView
          android:id="@+id/boxy"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_below="@+id/addTitle"
          android:layout_margin="15dp"
          android:background="@color/clouds"
          android:orientation="vertical"
          android:padding="15dp"
          tools:ignore="UselessLeaf" &gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical" &gt;
  
              &lt;EditText
                  android:id="@+id/addQuestionNumber"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:hint="@string/qNo"
                  android:inputType="number" /&gt;
  
              &lt;EditText
                  android:id="@+id/addQuestion"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:hint="@string/q"
                  android:inputType="textMultiLine" /&gt;
  
              &lt;EditText
                  android:id="@+id/addQuestionAnswer"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:hint="@string/qAns"
                  android:inputType="text" /&gt;
  
              &lt;EditText
                  android:id="@+id/addQuestionHint"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:hint="@string/qHint"
                  android:inputType="text" /&gt;
  
              &lt;Button
                  android:id="@+id/addQuestionImage"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="10dp"
                  android:background="@drawable/button_click"
                  android:text="@string/uQImage"
                  android:textColor="@color/turquoize" /&gt;
  
              &lt;ImageView
                  android:id="@+id/addQuestionImageView"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center_horizontal"
                  android:layout_marginTop="15dp"
                  android:background="@color/black"
                  android:contentDescription="@string/qImage"
                  android:visibility="gone" /&gt;
          &lt;/LinearLayout&gt;
      &lt;/ScrollView&gt;
  
      &lt;Button
          android:id="@+id/addQuestionAdd"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:layout_margin="15dp"
          android:background="@drawable/button_click"
          android:text="@string/addQuestionDo"
          android:textColor="@color/turquoize" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>