title: array out of bound with inappropriate output
body: <pre><code>public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          // Inflate the layout for this fragment
  
  
          View view = inflater.inflate(R.layout.fragment_tab1, container, false);
  
          recyclerView =  view.findViewById(R.id.recyler);
          adapter = new tabAdapter(getActivity(),getdata());
          recyclerView.setAdapter(adapter);
          recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  
          return view;
      }
  
      public List&lt;information&gt; getdata(){
  
          List&lt;information&gt; data = new ArrayList&lt;&gt;();
          int[] im = {R.mipmap.ic_launcher,R.mipmap.ic_launcher_round,R.mipmap.ic_launcher_round,R.mipmap.ic_launcher};
          String[] ti ={"shubham","prasad","xxxxx","dummydata"};
          for(int i=0;i&lt;ti.length &amp;&amp; i&lt;im.length;i++){
              information info = new information();
              info.img=im[i];
              info.str=ti[i];
              data.add(info);
  
          }
          return data;
      }
  </code></pre>
  
  <p>and getting exception
  FATAL EXCEPTION: main
                                                                         Process: com.example.android.abc, PID: 3385
                                                                         java.lang.ArrayIndexOutOfBoundsException: length=4; index=4
                                                                             at com.example.android.abc.tab1.getdata(tab1.java:104)
                                                                             at com.example.android.abc.tab1.onCreateView(tab1.java:88)</p>
  
  <p>tabAdapter class
  public class tabAdapter extends RecyclerView.Adapter {</p>
  
  <pre><code>private LayoutInflater lf;
  
  
  List&lt;information&gt; data = Collections.emptyList();
  </code></pre>
  
  <p>public tabAdapter(Context context,List data){</p>
  
  <pre><code>   lf=LayoutInflater.from(context);
     this.data=data;
  </code></pre>
  
  <p>}</p>
  
  <pre><code>@Override
  public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  
      View view = lf.inflate(R.layout.res,parent,false);
  
      MyViewHolder ms = new MyViewHolder(view);
      return ms;
  }
  
  @Override
  public void onBindViewHolder(MyViewHolder holder, int position) {
      information info=data.get(position);
  
      holder.tx.setText(info.str);
      holder.tm.setImageResource(info.img);
  
  
  }
  
  @Override
  public int getItemCount() {
      return data.size();
  }
  
  
  class MyViewHolder extends RecyclerView.ViewHolder {
  
      TextView tx;
      ImageView tm;
      public MyViewHolder(View itemView) {
          super(itemView);
          tx = itemView.findViewById(R.id.ids);
          tm = itemView.findViewById(R.id.imag);
      }
  }
  </code></pre>
  
  <p>}</p>