title: How do I download various types of files(images, videos , texts) from Firebase and display them
body: <p>I am trying to make an app where I need to retrieve data from firebase which can be anything(images, videos , texts) and display them. After searching and through guidance I found <a href="https://stackoverflow.com/questions/26245139/how-to-create-recyclerview-with-multiple-view-type">this</a> link, but it doesnt show me how do I download  <strong>all the files</strong> and even how do I get the <a href="https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter.html#getItemViewType(int)" rel="nofollow noreferrer">getItemViewType()</a> to place it in a recycler view.</p>
  
  <p>This is the adapter</p>
  
  <pre><code>public class MultiViewTypeAdapter extends RecyclerView.Adapter {
  
  private ArrayList&lt;Model&gt;dataSet;
  Context mContext;
  int total_types;
  MediaPlayer mPlayer;
  private boolean fabStateVolume = false;
  
  public static class TextTypeViewHolder extends RecyclerView.ViewHolder {
  
      TextView txtType;
      CardView cardView;
  
      public TextTypeViewHolder(View itemView) {
          super(itemView);
  
          this.txtType = (TextView) itemView.findViewById(R.id.type);
          this.cardView = (CardView) itemView.findViewById(R.id.card_view);
      }
  }
  
  public static class ImageTypeViewHolder extends RecyclerView.ViewHolder {
  
      TextView txtType;
      ImageView image;
  
      public ImageTypeViewHolder(View itemView) {
          super(itemView);
  
          this.txtType = (TextView) itemView.findViewById(R.id.type);
          this.image = (ImageView) itemView.findViewById(R.id.background);
      }
  }
  
  public static class VideoTypeViewHolder extends RecyclerView.ViewHolder {
  
      TextView txtType;
      VideoView video;
  
      public VideoTypeViewHolder(View itemView) {
          super(itemView);
  
          this.txtType = (TextView) itemView.findViewById(R.id.type);
          this.video = (VideoView) itemView.findViewById(R.id.videoView2);
      }
  }
  
  public MultiViewTypeAdapter(ArrayList&lt;Model&gt;data, Context context) {
      this.dataSet = data;
      this.mContext = context;
      total_types = dataSet.size();
  }
  
  @Override
  public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  
      View view;
      switch (viewType) {
          case Model.TEXT_TYPE:
              view = LayoutInflater.from(parent.getContext()).inflate(R.layout.text_type, parent, false);
              return new TextTypeViewHolder(view);
          case Model.IMAGE_TYPE:
              view = LayoutInflater.from(parent.getContext()).inflate(R.layout.image_type, parent, false);
              return new ImageTypeViewHolder(view);
          case Model.VIDEO_TYPE:
              view = LayoutInflater.from(parent.getContext()).inflate(R.layout.video_type, parent, false);
              return new VideoTypeViewHolder(view);
      }
      return null;
  }
  
  @Override
  public int getItemViewType(int position) {
  
      switch (dataSet.get(position).type) {
          case 0:
              return Model.TEXT_TYPE;
          case 1:
              return Model.IMAGE_TYPE;
          case 2:
              return Model.VIDEO_TYPE;
          default:
              return -1;
      }
  }
  
  @Override
  public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int listPosition) {
  
      Model object = dataSet.get(listPosition);
      if (object != null) {
          switch (object.type) {
              case Model.TEXT_TYPE:
                  ((TextTypeViewHolder) holder).txtType.setText(object.text);
  
                  break;
              case Model.IMAGE_TYPE:
                  ((ImageTypeViewHolder) holder).txtType.setText(object.text);
                  ((ImageTypeViewHolder) holder).image.setImageResource(object.data);
                  break;
              case Model.VIDEO_TYPE:
  
  
                  break;
          }
      }
  }
  
  @Override
  public int getItemCount() {
      return dataSet.size();
  }
  }
  </code></pre>
  
  <p>This is the model class</p>
  
  <pre><code>public class Model {
  
  public static final int TEXT_TYPE=0;
  public static final int IMAGE_TYPE=1;
  public static final int VIDEO_TYPE=2;
  
  public int type;
  public int data;
  public String text;
  
  public Model(int type, String text, int data)
  {
      this.type=type;
      this.data=data;
      this.text=text;
  }
  }
  </code></pre>