Creating a drop down menu from a .json file
<pre><code>package com.example.root.myapplication;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;

import org.json.JSONArray;
import org.json.JSONException;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    Button btnCommercial;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final ListView list11 = (ListView) findViewById(R.id.listView1);
        ArrayList&lt;String&gt; authorities = getAuthorities("AuthorityList.json");
        final ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_dropdown_item, authorities);
        btnCommercial = (Button) findViewById(R.id.btnCommercial);
        btnCommercial.setOnClickListener(
                new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        list11.setAdapter(adapter);
                    }
                });
    }

    private ArrayList&lt;String&gt; getAuthorities(String fileName) {
        JSONArray jsonArray = null;
        ArrayList&lt;String&gt; AuthList = new ArrayList&lt;String&gt;();

        try {
            InputStream inputStream = getAssets().open(fileName);       //open the inputStream to the file
            int size = inputStream.available();                         //size of the entire json object
            byte[] data = new byte[size];                               //array that will store all the data
            inputStream.read(data);                                     //reading data into the array for the file
            inputStream.close();                                        //close the input steam
            String json = new String(data, "UTF-8");
            jsonArray = new JSONArray(json);

            if (jsonArray != null) {
                for (int i = 0; i &lt; jsonArray.length(); i++) {
                    AuthList.add(jsonArray.getJSONObject(i).getString("description"));
                }
            }
        } catch (IOException e) {
            e.printStackTrace(); return null;
        } catch (JSONException je) {
            je.printStackTrace(); return null;
        }
        return AuthList;
    }
}
</code></pre>

<p><a href="https://i.stack.imgur.com/ssrmL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ssrmL.png" alt="enter image description here"></a>
I want to create a drop down menu with data from a JSON file that is in my project. I was struggling to access my remote server through soapui, so I copied the .json file into my project under assets. The code doesn't give me an error, but my app won't run. I think the problem is how I'm opening the .json file or how I access the objects. </p>

<p>Thank you in advance.</p>