title: How to solve "java.lang.NumberFormatException: s == null at java.lang.Integer.parseInt"
body: <p>I tried different things for solution but as I failed, I need to know what's wrong with my code and what it should be.</p>
  
  <p>Here is my logcat error</p>
  
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
                                                                        Process: freemig.freemigmessenger, PID: 31699
                                                                        java.lang.NumberFormatException: s == null
                                                                            at java.lang.Integer.parseInt(Integer.java:570)
                                                                            at java.lang.Integer.parseInt(Integer.java:643)
  </code></pre>
  
  <p>And it happens on a button click event which is </p>
  
  <pre><code>    private class SentMessageHolder extends RecyclerView.ViewHolder {
      TextView messageText, timeText;
      ImageButton iB;
      MsgDltAPIService msgDltAPIService;
      String rec_id;
      String content_id;
      int[] ids = new int[100];
  
      SentMessageHolder(final View itemView) {
          super(itemView);
  
          messageText = itemView.findViewById(R.id.text_message_body);
          timeText = itemView.findViewById(R.id.text_message_time);
          iB = itemView.findViewById(R.id.sentMessageTextDelete);
          msgDltAPIService = RestClient.getClient().create(MsgDltAPIService.class);
  
          iB.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  userAuthenticationKey = new UserAuthenticationKey(mContext.getApplicationContext());
                  sharedPreferences =  mContext.getApplicationContext().getSharedPreferences("user authentication", MODE_PRIVATE);
                  editor = sharedPreferences.edit();
                  ids[0] = Integer.parseInt(content_id);
                  final MsgDltRequest msgDltRequest = new MsgDltRequest(
                          ids,
                          rec_id);
                  Call&lt;MsgDltResponse&gt; call =
                          msgDltAPIService.msgDlt(userAuthenticationKey.getUserTokenKey(),
                                  msgDltRequest);
                  call.enqueue(new Callback&lt;MsgDltResponse&gt;() {
                      @Override
                      public void onResponse(Call&lt;MsgDltResponse&gt; call, Response&lt;MsgDltResponse&gt; response) {
  
                          Toast.makeText(mContext.getApplicationContext(), "" + response.body().getData(),
                                  Toast.LENGTH_LONG).show();
                      }
  
                      @Override
                      public void onFailure(Call&lt;MsgDltResponse&gt; call, Throwable t) {
                          Toast.makeText(mContext.getApplicationContext(), "please try again",
                                  Toast.LENGTH_LONG).show();
                      }
                  });
              }
          });
      }
  
      void bind(Datum2 message) {
          messageText.setText(message.getMsg());
  
          // Format the stored timestamp into a readable String using method.
          timeText.setText(message.getCreatedAt().getFormatTime());
          content_id.valueOf(message.getContentId().toString()) ;
          if (! message.getOriginatorId().equals(userID)){
              rec_id.valueOf(message.getOriginatorId());
          }
          else {
              rec_id = null;
          }
                          }
  
  }
  </code></pre>
  
  <p>It gives me error on this line</p>
  
  <pre><code>ids[0] = Integer.parseInt(content_id);
  </code></pre>
  
  <p>I tried several things as I said previously , but what should be my code?<a href="https://pastebin.com/QDz3YeuM" rel="nofollow noreferrer"> My full class is here</a>. One more thing I'm working on a Adapter Class.</p>