title: Android Recycler View with Firebase
body: <p>I'm trying to use a recycler view inside a fragment and am using firebase to get data from the database. The problem is none of my recycler view methods such as onCreateViewHolder, onBindViewHolder, getItemCount are being called when I'm setting the adapter. This I can confirm by running the app in debugger mode. 
  My fragment:</p>
  
  <p>public class Ongoing extends Fragment {</p>
  
  <pre><code>RecyclerView recyclerView;
  ProjectAdapter adapter;
  ArrayList&lt;ProjectModel&gt; project ;
  
  String[] project_name = new String[3];
  String[] project_desc = new String[3];
  
      @Nullable
      @Override
      public View onCreateView(final LayoutInflater inflater, @Nullable final ViewGroup container, @Nullable Bundle savedInstanceState) {
  
          View v = inflater.inflate(R.layout.project_layout, container, false);
          recyclerView = (RecyclerView) v.findViewById(R.id.rv_projects);
          project = new ArrayList&lt;&gt;();
          FirebaseDatabase database = FirebaseDatabase.getInstance();
          DatabaseReference ref = database.getReference("projects");
  
          ref.child("ongoing").addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
  
                  int i = 0;
                  for(DataSnapshot dsp: dataSnapshot.getChildren()){
                      //System.out.println(dsp.child("name").getValue());
                      //System.out.println(dsp.child("description").getValue());
                      //ProjectModel p = new ProjectModel(dsp.child("name").getValue().toString(),dsp.child("description").getValue().toString());
                      //project.add(i,p);
                      project_name[i]= dsp.child("name").getValue().toString();
                      project_desc[i]= dsp.child("description").getValue().toString();
                      i++;
                  }
                  System.out.println(project_name);
                  System.out.println(project_desc);
  
              }
  
              @Override
              public void onCancelled(DatabaseError databaseError) {
  
              }
          });
  
          adapter = new ProjectAdapter(project_name, project_desc,getActivity());
          recyclerView.setAdapter(adapter);
          LinearLayoutManager llm = new LinearLayoutManager(getActivity(),LinearLayoutManager.HORIZONTAL, false);
          recyclerView.setLayoutManager(llm);
          return v;
  
      }
  </code></pre>
  
  <p>}</p>
  
  <p>My RecyclerView adapter:</p>
  
  <pre><code>import android.content.Context;
  import android.support.v7.widget.RecyclerView;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.TextView;
  
  import com.adg.adgofficial.R;
  
  public class ProjectAdapter extends RecyclerView.Adapter&lt;ProjectAdapter.ProjectViewHolder&gt;{
  
      String[] project_name,project_desc;
      //ArrayList&lt;ProjectModel&gt; project;
      Context context;
  
      public ProjectAdapter( String[] project_name,String[] project_desc ,Context context) {
  
          this.project_name = project_name;
          this.project_desc = project_desc;
          this.context = context;
      }
  
      @Override
      public ProjectViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View view = LayoutInflater.from(context).inflate(R.layout.projects_element,parent,false);
          return new ProjectViewHolder(view);
      }
  
      @Override
      public void onBindViewHolder(ProjectViewHolder holder, int position) {
          holder.title.setText(project_name[position]);
          holder.desc.setText(project_desc[position]);
      }
  
  
      @Override
      public int getItemCount() {
          return 3;
      }
  
      public static class ProjectViewHolder extends RecyclerView.ViewHolder {
  
          TextView title, desc;
  
          public ProjectViewHolder(View itemView) {
              super(itemView);
              title = (TextView) itemView.findViewById(R.id.proj_element_title);
              desc = (TextView) itemView.findViewById(R.id.proj_element_desc);
          }
      }
  }
  </code></pre>
  
  <p>This issue has been troubling me for weeks and I can't seem to find a solution to it. Thanks in advance for the help. </p>