title: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference (spinner)
body: <p>i have this code </p>
  
  <pre><code>//get Info from Json 
      ic_Spe_categorie = findViewById(R.id.ic_Spe_categorief);
  
      StringRequest request = new StringRequest(Request.Method.GET, URL, new Response.Listener&lt;String&gt;() {
          @Override
          public void onResponse(String response) {
              final HashMap&lt;String,Integer&gt; mapList=new HashMap&lt;&gt;();
  
              try {
                  JSONObject source = new JSONObject(response);
                  JSONArray path = source.getJSONArray("hotel");
  
                  Spe_categorie = new String[path.length()];
  
                  for (int i = 0; i &lt; path.length(); i++){
                      JSONObject object = path.getJSONObject(i);
                      if(object.getString("hotel_id").equals("100972")){
  
                          String categorie = object.getString("categorie_chambre_name");
  
  
  
                          Spe_categorie[i] = categorie ;
  
                          Log.d("categorie", object.getString("categorie_chambre_name"));
  
                          ArrayAdapter arrayAdapter_cat = new ArrayAdapter(SearchHotelActivity.this, android.R.layout.simple_spinner_item , Spe_categorie);
                          arrayAdapter_cat.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                          ic_Spe_categorie.setAdapter(arrayAdapter_cat);
                      }
  
  
  
                  }
              } catch (JSONException e) {
                  e.printStackTrace();
              }
  
          }
      }, new Response.ErrorListener() {
          @Override
          public void onErrorResponse(VolleyError error) {
  
          }
      }) ;
      queue.add(request);
  </code></pre>
  
  <p>im trying to fill the spinner (ic_Spe_categorie) with line (categorie_chambre_name) from database using json REST API </p>
  
  <p>spinner is actually fills up with all lines (categorie_chambre_name) if i do not use the if if statement</p>
  
  <p>all i want is the line (categorie_chambre_name) linked to my hotel id (100972) </p>
  
  <p>when i try to put a condition if the hotel_id is equals to a my hotel id (100972) already exists in the database</p>
  
  <p>give me this error</p>
  
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
  Process: ma.transatour.transatourmaroc, PID: 12734
  java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference
      at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:453)
      at android.widget.ArrayAdapter.getView(ArrayAdapter.java:415)
      at android.widget.AbsSpinner.onMeasure(AbsSpinner.java:204)
      at android.widget.Spinner.onMeasure(Spinner.java:602)
      at android.support.v7.widget.AppCompatSpinner.onMeasure(AppCompatSpinner.java:426)
      at android.view.View.measure(View.java:23169)
      at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
      at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
      at android.view.View.measure(View.java:23169)
      at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1308)
      at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
      at android.widget.ScrollView.onMeasure(ScrollView.java:350)
      at android.view.View.measure(View.java:23169)
      at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
      at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
      at android.view.View.measure(View.java:23169)
      at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
      at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
      at android.view.View.measure(View.java:23169)
      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
      at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
      at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
      at android.view.View.measure(View.java:23169)
      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
      at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:400)
      at android.view.View.measure(View.java:23169)
      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
      at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
      at android.view.View.measure(View.java:23169)
      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
      at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535)
      at android.widget.LinearLayout.measureVertical(LinearLayout.java:825)
      at android.widget.LinearLayout.onMeasure(LinearLayout.java:704)
      at android.view.View.measure(View.java:23169)
      at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
      at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
      at com.android.internal.policy.DecorView.onMeasure(DecorView.java:716)
      at android.view.View.measure(View.java:23169)
      at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2718)
      at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1572)
      at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1855)
      at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1460)
      at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7183)
      at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)
      at android.view.Choreographer.doCallbacks(Choreographer.java:761)
      at android.view.Choreographer.doFrame(Choreographer.java:696)
      at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
      at android.os.Handler.handleCallback(Handler.java:873)
      at android.os.Handler.dispatchMessage(Handler.java:99)
      at android.os.Looper.loop(Looper.java:193)
      at android.app.ActivityThread.main(ActivityThread.java:6669)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
  </code></pre>