title: How to fix code to display data from Firebase?
body: <p>I already ask similar question, When i click on <code>textview(header_news from firebase)</code>, i switch to another activity and load data from Firebase. In another activity i get the same data(1 news by id). But i want to be displayed <code>main_news</code>. I know where problem, but i dont know how to fix it. I think problem in bindviewholder becouse i dont add  <code>myViewHolder.main_news.setText(Mnews.get(i).getMain_news());</code> But i cant to add, becouse its be displayed on header news.... P.S Sorry for my english i hope you understand me.</p>
  
  <p>Adapter Code:</p>
  
  <pre><code>    public class NewsAdapter extends RecyclerView.Adapter&lt;NewsAdapter.MyViewHolder&gt; {
  
      Context Mcontext;
      ArrayList&lt;News&gt; Mnews;
  
  
      public NewsAdapter(Context Mcontext, ArrayList&lt;News&gt; Mnews)
      {
          this.Mnews = Mnews;
          this.Mcontext = Mcontext;
      }
  
      @NonNull
      @Override
      public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
          return new MyViewHolder(LayoutInflater.from(Mcontext).inflate(R.layout.news_view, viewGroup, false));
      }
  
      @Override
      public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int i) {
          final News news = Mnews.get(i);
          myViewHolder.news_date.setText(Mnews.get(i).getDatenews());
          myViewHolder.news_header.setText(Mnews.get(i).getHeader_news());
  
          Picasso.get().load(Mnews.get(i).getImageURL()).into(myViewHolder.news_picture);
  
          myViewHolder.itemView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
                  Intent intent = new Intent(Mcontext, NewsActivity.class);
                  intent.putExtra("idnews", news.getIdnews());
                  Mcontext.startActivity(intent);
  
              }
          });
  
      }
  
      @Override
      public int getItemCount() {
         return Mnews.size();
     }
  
      class MyViewHolder extends RecyclerView.ViewHolder {
  
          TextView news_date, news_header, main_news;
          ImageView news_picture;
  
          public MyViewHolder(@NonNull View itemView) {
              super(itemView);
  
              news_date = (TextView) itemView.findViewById(R.id.news_date);
              news_header = (TextView) itemView.findViewById(R.id.news_header);
              news_picture = (ImageView) itemView.findViewById(R.id.news_picture);
          }
      }
  }
  </code></pre>
  
  <p>And Activity code:</p>
  
  <pre><code>    public class NewsActivity extends AppCompatActivity {
      String idnews;
      TextView main_news;
      DatabaseReference reference;
      TextView news_date;
      RecyclerView recyclerView;
      Intent intent;
      ArrayList&lt;News&gt; Nlist;
      NewsAdapter adapter;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_news);
  
          recyclerView = findViewById(R.id.recycler_view);
          recyclerView.setHasFixedSize(true);
          LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getApplicationContext());
          linearLayoutManager.setStackFromEnd(true);
          recyclerView.setLayoutManager(linearLayoutManager);
          main_news = findViewById(R.id.main_news);
          intent = getIntent();
          idnews = intent.getStringExtra("idnews");
  
          Nlist = new ArrayList&lt;News&gt;();
          reference = FirebaseDatabase.getInstance().getReference("News").child(idnews);
          reference.addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
  
                  Nlist.clear();
                  News news = dataSnapshot.getValue(News.class);
                  main_news.setText(news.getNews_main());
                  Nlist.add(news);
  
                  adapter = new NewsAdapter(getApplicationContext(), Nlist);
                  recyclerView.setAdapter(adapter);
  
              }
  
              @Override
              public void onCancelled(@NonNull DatabaseError databaseError) {
                  Toast.makeText(NewsActivity.this, "Что то не так", Toast.LENGTH_SHORT).show();
              }
          });
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Jma2T.png" rel="nofollow noreferrer">My database struct</a></p>
  
  <p>I hope you can help me.</p>