title: android spinner to load json crashes
body: <p>I am trying to fetch an array list using volley and display it in a spinner but my app crashes.
  here is the main activity of the app</p>
  
  <pre><code>package com.example.shivadeeps.webservice;
  
  import android.content.Context;
  import android.graphics.Bitmap;
  import android.os.Bundle;
  import android.support.v7.app.AppCompatActivity;
  import android.util.Config;
  import android.util.Log;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.ArrayAdapter;
  import android.widget.Spinner;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import com.android.volley.Request;
  import com.android.volley.RequestQueue;
  import com.android.volley.Response;
  import com.android.volley.VolleyError;
  import com.android.volley.toolbox.ImageLoader;
  import com.android.volley.toolbox.JsonObjectRequest;
  import com.android.volley.toolbox.StringRequest;
  import com.android.volley.toolbox.Volley;
  import org.json.JSONArray;
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import org.json.JSONObject;
  
  import java.util.ArrayList;
  import static java.lang.Character.getName;
  
  public class MainActivity extends AppCompatActivity {
  private Spinner spinner;
  private ArrayList&lt;String&gt; trips;
  private JSONArray result;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      trips= new ArrayList&lt;String&gt;();
      this.spinner = (Spinner) findViewById(R.id.spinner);
      spinner.setOnItemSelectedListener((AdapterView.OnItemSelectedListener) this);
      loadtrip();
  }
  public void loadtrip() {
      StringRequest stringRequest = new StringRequest(config.DATA_URL,
              new Response.Listener&lt;String&gt;() {
                  public void onResponse(String response) {
                      JSONObject j = null;
                      try {
                          j = new JSONObject(response);
                          result = j.getJSONArray(config.JSON_ARRAY);
                          getStudents(result);
                      } catch (JSONException e) {
                          e.printStackTrace();
                      }
                  }
              },
              new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
                  }
              });
      RequestQueue requestQueue = Volley.newRequestQueue(this);
      requestQueue.add(stringRequest);
  }
  private void getStudents(JSONArray j){
      for(int i=0;i&lt;j.length();i++){
          try {
              JSONObject json = j.getJSONObject(i);
              trips.add(json.getString(config.DATA_URL));
          } catch (JSONException e) {
              e.printStackTrace();
          }
      }
  
      //Setting adapter to show the items in the spinner
      spinner.setAdapter(new ArrayAdapter&lt;String&gt;(MainActivity.this, android.R.layout.simple_spinner_dropdown_item,trips));
  }
  public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) {
      String item = parent.getItemAtPosition(position).toString();
      Toast.makeText(parent.getContext(), "Selected: " + item, Toast.LENGTH_LONG).show();
  }
  public void onNothingSelected(AdapterView&lt;?&gt; parent) {
  
  
  }
  
  
  }
  </code></pre>
  
  <p>XML code: </p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
   &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/activity_main"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:background="@color/red"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context="com.example.shivadeeps.webservice.MainActivity"&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-sdk
      android:minSdkVersion="14"
      android:targetSdkVersion="23" /&gt;
  
  &lt;Spinner
      android:id="@+id/spinner"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_marginBottom="80dp"
  
      android:layout_marginTop="100dp" &gt;&lt;/Spinner&gt;
  &lt;TextView
      android:id="@+id/text_id"
      android:layout_width="300dp"
      android:layout_height="200dp"
      android:textColor="@android:color/holo_blue_dark"
      android:textColorHighlight="@android:color/primary_text_dark"
      android:layout_centerVertical="true"
      android:textSize="50dp"/&gt;
     &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>here is the logcat</p>
  
  <blockquote>
    <p>01-10 11:29:25.226 12404-12404/com.example.shivadeeps.webservice<br>
    E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                          Process: com.example.shivadeeps.webservice, PID: 12404
                                                                                       java.lang.RuntimeException: Unable to start activity
    ComponentInfo{com.example.shivadeeps.webservice/com.example.shivadeeps.webservice.MainActivity}:
    android.view.InflateException: Binary XML file line #13: Error
    inflating class uses-permission
                                                                                           at
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3190)
                                                                                           at
    android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3300)
                                                                                           at android.app.ActivityThread.access$1000(ActivityThread.java:211)
                                                                                           at
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1705)
                                                                                           at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                           at android.os.Looper.loop(Looper.java:145)
                                                                                           at android.app.ActivityThread.main(ActivityThread.java:6946)
                                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                                           at java.lang.reflect.Method.invoke(Method.java:372)
                                                                                           at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
                                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
                                                                                        Caused by: android.view.InflateException: Binary XML file line #13:
    Error inflating class uses-permission
                                                                                           at
    android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
                                                                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
                                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
                                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
                                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:366)
                                                                                           at
    android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
                                                                                           at
    android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143)
                                                                                           at
    com.example.shivadeeps.webservice.MainActivity.onCreate(MainActivity.java:40)
                                                                                           at android.app.Activity.performCreate(Activity.java:6575)
                                                                                           at
    android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1134)
                                                                                           at
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3143)
                                                                                           at
    android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3300) 
                                                                                           at android.app.ActivityThread.access$1000(ActivityThread.java:211) 
                                                                                           at
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1705) 
                                                                                           at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                           at android.os.Looper.loop(Looper.java:145) 
                                                                                           at android.app.ActivityThread.main(ActivityThread.java:6946) 
                                                                                           at java.lang.reflect.Method.invoke(Native Method) 
                                                                                           at java.lang.reflect.Method.invoke(Method.java:372) 
                                                                                           at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) 
                                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) 
                                                                                        Caused by: java.lang.ClassNotFoundException: Didn't find class
    "android.view.uses-permission" on path: DexPathList[[zip file
    "/data/app/com.example.shivadeeps.webservice-2/base.apk"],nativeLibraryDirectories=[/vendor/lib,
    /system/lib]]
                                                                                           at
    dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                                           at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                                                           at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                                                           at android.view.LayoutInflater.createView(LayoutInflater.java:578)
                                                                                           at android.view.LayoutInflater.onCreateView(LayoutInflater.java:672)
                                                                                           at
    com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:65)
                                                                                           at android.view.LayoutInflater.onCreateView(LayoutInflater.java:689)
                                                                                           at
    android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:748)
                                                                                           at android.view.LayoutInflater.rInflate(LayoutInflater.java:813) 
                                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:511) 
                                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:415) 
                                                                                           at android.view.LayoutInflater.inflate(LayoutInflater.java:366) 
                                                                                           at
    android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284) 
                                                                                           at
    android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143) 
                                                                                           at
    com.example.shivadeeps.webservice.MainActivity.onCreate(MainActivity.java:40) 
                                                                                           at android.app.Activity.performCreate(Activity.java:6575) 
                                                                                           at
    android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1134) 
                                                                                           at
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3143) 
                                                                                           at
    android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3300) 
                                                                                           at android.app.ActivityThread.access$1000(ActivityThread.java:211) 
                                                                                           at
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1705) 
                                                                                           at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                           at android.os.Looper.loop(Looper.java:145) 
                                                                                           at android.app.ActivityThread.main(ActivityThread.java:6946) 
                                                                                           at java.lang.reflect.Method.invoke(Native Method) 
                                                                                           at java.lang.reflect.Method.invoke(Method.java:372) 
                                                                                           at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) 
                                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) 
                                                                                          Suppressed: java.lang.ClassNotFoundException: Didn't find class
    "android.view.uses-permission" on path: DexPathList[[dex file
    "/data/data/com.example.shivadeeps.webservice/files/instant-run/dex/slice-support-annotations-25.0.1_485a49a20ae18735d596aaa75d964eacffc01e9a-classes.dex",
    dex file
    "/data/data/com.example.shivadeeps.webservice/files/instant-run/dex/slice-slice_9-classes.dex",
    dex file
    "/data/data/com.example.shivadeeps.webservice/files/instant-run/dex/slice-slice_8-classes.dex",
    dex file
    "/data/data/com.example.shivadeeps.webservice/files/instant-run/dex/slice-slice_7-classes.dex",
    dex file
    "/data/data/com.example.shivadeeps.webservice/files/instant-run/dex/slice-slice_6-classes.dex",
    dex file
    "/data/data/com.example.shivadeeps.webservice/files/instant-run/dex/slice-slice_5-classes.dex",
    dex file
    "/data/data/com.example.shivadeeps.webservice/files/instant-run/dex/slice-slice_4-classes.dex",
    dex file
    "/data/data/com.example.shivadeeps.webservice/files/instant-run/dex/slice-slice_3-classes.dex",
    dex file
    "/data/data/com.example.shivadeeps.webservice/files/instant-run/dex/slice-slice_2-classes.dex",
    dex file
    "/data/data/com.example.shivadeeps.webservice/files/instant-run/dex/slice-slice_1-classes.dex",
    dex file "/data/data/com.exa 01-10 11:29:25.231 2827-3392/?
    W/ActivityManager:   Force finishing activity 1
    com.example.shivadeeps.webservice/.MainActivity 01-10 11:29:25.241
    2827-3392/? D/InputDispatcher: Focused application set to: xxxx 01-10
    11:29:25.311 12691-12691/? D/Mms/MmsApp: [start]    initCountryIso
    consume time = 103.6345 01-10 11:29:25.316 2827-3621/?
    D/CountryDetector: The first listener is added 01-10 11:29:25.321
    12691-12691/? D/Mms/MmsApp: [end]    initCountryIso consume time =
    9.456961 01-10 11:29:25.416 2156-11978/? I/display: [PrimaryDisplay] [DYNAMIC_RECOMP] GLES_2_HWC by BW check 01-10 11:29:25.436
    11562-11587/? I/Icing: Indexing
    7491238841BD1692167B469A759AF4A2F8E28FA8 from
    com.google.android.googlequicksearchbox 01-10 11:29:25.486 2827-3114/?
    E/Watchdog: !@Sync 5200 [01-10 11:29:25.488] 01-10 11:29:25.531
    12691-12691/? D/Mms/MmsConfig: [start]    MmsConfig.init() consume
    time = 210.034154 01-10 11:29:25.546 2827-3392/? I/WindowManager:
    Screenshot max retries 4 of Token{1ad8e437 ActivityRecord{3b472d36 u0
    com.example.shivadeeps.webservice/.MainActivity t440 f}}
    appWin=Window{2e5a232f u0 d0 Starting
    com.example.shivadeeps.webservice} drawState=4 01-10 11:29:25.551
    12691-12691/? D/EasySignUpManager_1.15.0305: isAuth is false 01-10
    11:29:25.551 2827-12720/? E/android.os.Debug: ro.product_ship = true
    01-10 11:29:25.551 2827-12720/? E/android.os.Debug: ro.debug_level =
    0x4f4c 01-10 11:29:25.556 12691-12691/? D/Mms/MmsConfig:
    getEasySignUpStatus sIsAuthEasySignUp=false,
    TelephonyUtils.getSimState(0)= 1 01-10 11:29:25.556 2827-2852/?
    D/PhoneWindow: <em>FMB</em> installDecor mIsFloating : true 01-10
    11:29:25.556 2827-2852/? D/PhoneWindow: <em>FMB</em> installDecor flags :
    8519682 01-10 11:29:25.556 12691-12691/?
    D/EasySignUpManager_1.15.0305: serviceId : 1, features : -1 01-10
    11:29:25.556 12691-12691/? D/EasySignUpManager_1.15.0305: isAuth is
    false 01-10 11:29:25.556 12691-12691/? D/EasySignUpManager_1.15.0305:
    getServiceStatus : serviceId (1) is OFF 01-10 11:29:25.556
    12691-12691/? D/Mms/MmsConfig: setFreeMessageEnabled,
    getSupportedFeatures = -1 sIsAuthEasySignUp = false
    sIsFreeMessageServiceStatus = false 01-10 11:29:25.556 12691-12691/?
    D/Mms/MmsConfig: Load Resize quality : 80 01-10 11:29:25.561
    12691-12691/? E/CscParser: mps_code.dat does not exist 01-10
    11:29:25.566 12691-12691/? E/CscParser: customer_path
    =/system/csc/customer.xml 01-10 11:29:25.566 12691-12691/? E/CscParser: fileName + /system/csc/customer.xml</p>
  </blockquote>