title: How set Jsoup data to RecyclerView in AsyncTask
body: <p>I'm parsing website title from URL, and set this title to <code>RecyclerView</code> item. When I call constructor, but I must use <code>AsyncTasck</code> for correctly work Jsoup. How can I set received data to <code>RecyclerView</code>?</p>
  
  <p>I can do public <code>MyAsyncTasck</code> instead of private, but i don't now if it is right.</p>
  
  <p>My <code>MainActivity.java</code>:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
      public static final String TAG  = "mLog";
  
      @BindView(R.id.recycler_view)
      RecyclerView recyclerView;
  
      @BindView(R.id.imageView)
      ImageView imageView;
  
      private RecyclerView.Adapter adapter;
      private List&lt;ListItem&gt; listItems;
      ListItem item;
  
      String URL = "https://sinoptik.ua/%D0%BF%D0%BE%D0%B3%D0%BE%D0%B4%D0%B0-
      %D0%B2%D0%B8%D0%BD%D0%BD%D0%B8%D1%86%D0%B0";
  
      Document document;
  
      // Received data from Jsoup
      String head = "something";
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          ButterKnife.bind(this);
  
          MyAsyncTask myAsyncTask = new MyAsyncTask();
          myAsyncTask.execute();
  
          recyclerView.setLayoutManager(new LinearLayoutManager(this));
          listItems = new ArrayList&lt;&gt;();
  
          item = new ListItem(head, "desc1");
          listItems.add(item);
  
          adapter = new MyRecViewAdapter(listItems, this);
          recyclerView.setAdapter(adapter);
      }
  
      private class MyAsyncTask extends AsyncTask&lt;Void, Void, Void&gt; {
  
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
          }
  
          @Override
          protected Void doInBackground(Void... voids) {
  
              try {
                  document = Jsoup.connect(URL).get();
                  head = document.title();
              } catch (IOException e ) {
                  e.printStackTrace();
              }
  
              return null;
          }
  
          @Override
          protected void onPostExecute(Void aVoid) {
            // ?????? 
          }
      }
  }
  </code></pre>
  
  <p>And <code>MyRecViewAdapter.java</code>:</p>
  
  <pre><code>public class MyRecViewAdapter extends RecyclerView.Adapter&lt;MyRecViewAdapter.ViewHolder&gt;{
  
      private List&lt;ListItem&gt; listItems;
      private Context context;
  
      public MyRecViewAdapter(List&lt;ListItem&gt; listItems, Context context) {
          this.listItems = listItems;
          this.context = context;
      }
  
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View v = LayoutInflater.from(parent.getContext())
                  .inflate(R.layout.list_item, parent, false);
          //return our view
          return new ViewHolder(v);
      }
  
      @Override
      public void onBindViewHolder(ViewHolder holder, int position) {
          ListItem listItem = listItems.get(position);
  
          holder.tvHead.setText(listItem.getHead());
          holder.tvDesc.setText(listItem.getDesc());
      }
  
      @Override
      public int getItemCount() {
          return listItems.size();
      }
  
      public static class ViewHolder extends RecyclerView.ViewHolder {
  
          public TextView tvHead;
          public TextView tvDesc;
  
          public ViewHolder(View itemView) {
              super(itemView);
  
              tvHead = (TextView) itemView.findViewById(R.id.tv_head);
              tvDesc = (TextView) itemView.findViewById(R.id.tv_desc);
          }
      }
  }
  </code></pre>
  
  <p>And the <code>ListItem.java</code></p>
  
  <pre><code>public class ListItem {
  
      private String head;
      private String desc;
  
      public ListItem(String head, String desc) {
          this.head = head;
          this.desc = desc;
      }
  
  
      public String getHead() {
          return head;
      }
  
      public String getDesc() {
          return desc;
      }
  }
  </code></pre>