title: Get Data of not visible items from recyclerview adapter
body: <p>I want a help from you guys can anybody solve this problem i am trying to insert three rows into mysql table but right here only two rows are visible and third on get visible on scrolling down so when i click submit it gets me an error it inserts 2 visible rows on the screen and throws a null pointer expection on the 3 row that is not visible can some one help me to get the data from the view that is not visible i know its recyclerview and it re uses the view i know the mechanism i just want the solution from some that so that the 3 row that is not visible can get added successfully to the database</p>
  
  <p>Here is an image for that :</p>
  
  <p><a href="https://imgur.com/a/rkARs" rel="nofollow noreferrer">https://imgur.com/a/rkARs</a></p>
  
  <p>My recyclerview adapter code:</p>
  
  <pre><code>public class MyAdapterClosing extends RecyclerView.Adapter&lt;MyAdapterClosing.myViewHolder&gt; {
  
      private Context context;
      private List&lt;DataofClosing&gt; student;
  
      public MyAdapterClosing(Context context, List&lt;DataofClosing&gt; student){
          this.context = context;
          this.student = student;
      }
  
      @Override
      public myViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.layoutclosing,parent,false);
          return new myViewHolder(itemView);
      }
  
      @Override
      public void onBindViewHolder(myViewHolder holder, int position) {
          DataofClosing s = student.get(position);
          holder.brand.setText(s.Brandname);
  
  
  
      }
  
  
      public void updateList(List&lt;RecyclerviewWholesale&gt; student)
      {
          student = student;
          notifyDataSetChanged();
      }
      public void addItem(int position, DataofClosing stud)
      {
          student.add(position, stud);
          notifyItemInserted(position);
      }
  
      public void removeItem(int position) {
          student.remove(position);
          notifyItemRemoved(position);
          notifyItemRangeChanged(position, student.size());
      }
  
  
  
      @Override
      public int getItemCount() {
          return student.size();
      }
  
  
      @Override
      public int getItemViewType(int position) {
  
          return position;
      }
  
  
  
      public class myViewHolder extends RecyclerView.ViewHolder{
          TextView brand;
          EditText qts,pts,nip,ml90;
  
          public myViewHolder(View itemView) {
              super(itemView);
  
              brand = (TextView) itemView.findViewById(R.id.brand);
              qts = (EditText) itemView.findViewById(R.id.qts);
              pts = (EditText) itemView.findViewById(R.id.pts);
              nip = (EditText) itemView.findViewById(R.id.nip);
              ml90 = (EditText) itemView.findViewById(R.id.ml90);
  
              String qtss = qts.getText().toString();
              String ptss = pts.getText().toString();
              String nipp = nip.getText().toString();
              String ml900 = ml90.getText().toString();
  
              DataofClosing dataofClosing = new DataofClosing();
              dataofClosing.qts = qtss;
              dataofClosing.pts = ptss;
              dataofClosing.nip = nipp;
              dataofClosing.ml90 = ml900;
  
  
  
          }
      }
  
  }
  </code></pre>
  
  <p>Inserting code in the main activity is:</p>
  
  <pre><code>class Insertclosing extends AsyncTask&lt;String, String, String&gt; {
  
          /**
           * Before starting background thread Show Progress Dialog
           */
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
          }
  
          /**
           * Creating product
           */
          protected String doInBackground(String... args) {
              for (int i = 0; i &lt; mAdapter.getItemCount(); i++) {
                  rcData = data.get(i);
                  View view1 = closingService.getChildAt(i);
                  EditText nameEditText = (EditText) view1.findViewById(R.id.qts);
                  String name = nameEditText.getText().toString();
                  EditText ptss = (EditText) view1.findViewById(R.id.pts);
                  String pts = ptss.getText().toString();
                  EditText nipp = (EditText) view1.findViewById(R.id.nip);
                  String nip = nipp.getText().toString();
                  EditText ml900 = (EditText) view1.findViewById(R.id.ml90);
                  String ml90 = ml900.getText().toString();
                  // Building Parameters
                  List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
  
                  params.add(new BasicNameValuePair("brand", rcData.Brandname));
                  params.add(new BasicNameValuePair("quantity", name));
                  params.add(new BasicNameValuePair("discount",pts));
                  params.add(new BasicNameValuePair("ammount",nip ));
  
  
                  // getting JSON Object
                  // Note that create product url accepts POST method
                  JSONObject json = jsonParser.makeHttpRequest(url_insert_product_sales,
                          "POST", params);
  
                  // check log cat fro response
                  Log.d("Create Response", json.toString());
  
                  // check for success tag
                  try {
                      int success = json.getInt(TAG_SUCCESS);
  
                      if (success == 1) {
                      /*runOnUiThread(new Runnable() {
                          public void run() {
  
                              Toast.makeText(ChangeAddress.this, "Order Placed Successfully", Toast.LENGTH_SHORT).show();
                          }
                      });*/
                      } else {
                          runOnUiThread(new Runnable() {
                              public void run() {
  
                                  Toast.makeText(closing.this, "Try Again", Toast.LENGTH_SHORT).show();
                              }
                          });               // failed to create product
                      }
                  } catch (JSONException e) {
                      e.printStackTrace();
                  }
              }
  
              return null;
          }
  
          /**
           * After completing background task Dismiss the progress dialog
           **/
          protected void onPostExecute(String file_url) {
  
               Toast.makeText(closing.this, "Closing added Successfully", Toast.LENGTH_SHORT).show();
  
          }
      }
  </code></pre>