title: Android Fragment Update TextView From AsyncTask onPostExecute
body: <p>I have an AsyncTask that uses HttpGet to fetch content from a remote server. I have tested and this is working fine, now I want to update a TextView with the result of this AsyncTask. Here is what I have done.</p>
  
  <p>From the OnCreateView of the Fragment, I get reference to a Button and a TextView, I initially hide the TextView and then in the OnClickListener for the button I want to unhide the textview and update that textview with the result of my AsyncTask</p>
  
  <pre><code> View rootView = inflater.inflate(R.layout.fragment_programs_list, container, false);
          Button btnLoadPrograms = (Button) rootView.findViewById(R.id.btnLoadPrograms);
          TextView tvShowPrograms = (TextView) rootView.findViewById(R.id.tvRestCall);
          tvShowPrograms.setVisibility(View.GONE);
  
          btnLoadPrograms.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  startNewAsyncTask();    
  
              }
          });
  
          return rootView;
  </code></pre>
  
  <p>Now in the onPostExecute of the AsyncTask, I want to update the Textview</p>
  
  <pre><code>@Override
          protected void onPostExecute(String result) {
              super.onPostExecute(result);
              getView().findViewById(R.id.tvRestCall).setVisibility(View.SHOW); //Does not exit
          }
  </code></pre>
  
  <p>How do I get a reference to the TextView from within the AsyncTask in a Fragment and then update that TextView with the result of the doinbackground.</p>