title: How to call fragment method from java class?
body: <p>I try to call fragment method from java class:
  I know there many of questions on stack overflow on this topic, but my case is different </p>
  
  <p>ConnectionAsyncTask.java :</p>
  
  <pre><code>import android.app.Activity;
  import android.os.AsyncTask;
  
  import java.util.List;
  
  public class ConnectionAsyncTask extends AsyncTask&lt;String,String,String&gt; {
      Activity activity;
      private EventListener listener;
  
      public ConnectionAsyncTask(Activity activity) {
          this.activity=activity;
      }
      @Override
      protected String doInBackground(String... params) {
          String content =HttpManager.getData(params[0]);
          return content;
      }
      @Override
      protected void onProgressUpdate(String... values) {
          super.onProgressUpdate(values);
      }
      @Override
      protected void onPostExecute(String s) {
          List&lt;Country&gt; countries= CountryJasonParser.getObjectFromJason(s);
          if (countries != null) {
              String s1 = "";
  
                  s1=s1+"\n"+"" + countries.get(0).getDes() ;
          //i want to call DisplyOnTextView(s1) 
          } 
      }
  }
  </code></pre>
  
  <p>countryfragment.java:</p>
  
  <pre><code>    import android.content.Intent;
      import android.os.Bundle;
      import android.support.design.widget.NavigationView;
      import android.view.LayoutInflater;
      import android.view.MenuItem;
      import android.view.View;
      import android.view.ViewGroup;
      import android.widget.ImageButton;
      import android.widget.ImageView;
      import android.widget.TextView;
  
      public class countryfragment extends android.support.v4.app.Fragment implements NavigationView.OnNavigationItemSelectedListener {
          TextView desc;
  
          public countryfragment() {
          }
  
          @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
              ConnectionAsyncTask connectionAsyncTask = new ConnectionAsyncTask(getActivity());
  //This is a server which contains data to load it            connectionAsyncTask.execute("http://www.mocky.io/v2/570d3677270000f600dc29b6");
              View view = inflater.inflate(R.layout.fragment_countryfragment,container,false);
              desc = (TextView) view.findViewById(R.id.desc);
  
              return view;
          }
          public void DisplyOnTextView(String s) {
              desc.setText(s);
          }
  
          @Override
          public boolean onNavigationItemSelected(MenuItem item) {
              return false;
          }
      }
  </code></pre>
  
  <hr>
  
  <p>The result must be:
  Display data on text view.</p>