Home JSONArray to Listview what am i doing wrong?
Reply: 0

JSONArray to Listview what am i doing wrong?

user1968 Published in April 22, 2018, 6:49 am

Hello guys i have now searched for the error or how to do it correct for some time and yes alot of questions in here have helped me closer i think.

but i got an API where i get a JSONArray and i want to show this data in a listview. So far i get my data in my log, and now i just try to show the name from each object to start with(then i can add the rest of data later) but im not sure if im on the right spot maybe someone can help me out here and show what im doing wrong?

Thanks alot

Listview name: AllBirds

protected void onCreate(Bundle savedInstanceState) {

    mAuth = FirebaseAuth.getInstance();

    String URL="myAPI";

    RequestQueue requestQueue= Volley.newRequestQueue(this);

    JsonArrayRequest objectRequest = new JsonArrayRequest (Request.Method.GET, URL, null, new Response.Listener<JSONArray>() {
        public void onResponse(JSONArray response) {
            Log.e("Rest Response",response.toString());

                for(int i=0; i<response.length();i++){
                    JSONObject jresponse = response.getJSONObject(i);
                    String NameDanish = jresponse.getString("NameDanish");

                    Log.d("NameDanish", NameDanish);

            }catch(JSONException e){

    }, new Response.ErrorListener() {
        public void onErrorResponse(VolleyError error) {
            Log.e("Rest Response",error.toString());


    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.activity_all_observation, NameDanish);

    ListView list = (ListView) findViewById(R.id.AllBirds);
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.307517 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO