title: Android - Passing View from Activity to AsyncTask class
body: <p><strong>MainActivity.java:</strong></p>
  
  <pre><code>private class NetCheck extends AsyncTask&lt;String, Void, Boolean&gt; {
      @Override
      protected Boolean doInBackground(String... args) {
          return cd.isConnectingToInternet();
      }
  
      protected void onPostExecute(Boolean th) {
          if (th == true) {
              new RemoteLoader(MainActivity.this).execute();
          }
      }
  }
  </code></pre>
  
  <p><strong>RemoteLoader.java:</strong></p>
  
  <pre><code>public class RemoteLoader extends AsyncTask&lt;Void, Void, Void&gt;{
      private View view;
  
      public RemoteLoader(View context){
          this.view = view;
      }
  
      @Override
      protected Void doInBackground(Void... Pages) {
               // do in bg
      }
  
      @Override
      protected void onPostExecute(Void result) {
          // Set title into TextView
          TextView txttitle = (TextView) view.findViewById(R.id.txtProtip);
          txttitle.setText(protip);
      }
  
  }
  </code></pre>
  
  <p>I'm trying to execute <code>RemoteLoader</code> class from <code>MainActivity</code>. But in RemoteLoader contains something that needs to inflate the Main layout.</p>
  
  <p>How do I pass the Layout from MainActivity to RemoteLoader in this case?</p>