title: How to create a method inside the onPostExecute?
body: <p>I tried to put if else inside the button onClick</p>
  
  <p>Here's the onClick</p>
  
  <pre><code>@Override
          public void onClick(View view) {
                  ettext.getText().toString();
                  viewword.getText().toString();
                  select();
  
                  if(viewword.equals("")) {
  
                      Toast.makeText(getBaseContext(), "Does not exist in database.1", Toast.LENGTH_LONG).show();
                  }else{
                      sendChatMessage();
                  }
  
  
          }
  </code></pre>
  
  <p>Here's the onPostExecute</p>
  
  <pre><code>@Override
          protected void onPostExecute(String result) {
              TextView disp = (TextView) findViewById(R.id.view);
              try {
                  JSONObject json_data = new JSONObject(result);
                  word = json_data.getString("server_response");
                  disp.setText(word);
  
  
              } catch (JSONException e) {
                  disp.setText("");
              }
  
          }
  </code></pre>
  
  <p>The problem is that the app is not reading the if else statement and proceed to onPostExecute. My solution was to create a method inside the onPostExecute but I don't know how.</p>