title: Android JSON array through URL
body: <p>im new and I making Android app which will be display info about items in Guild Wars 2 game. That data is here:
  <a href="https://api.guildwars2.com/v2/items" rel="nofollow">https://api.guildwars2.com/v2/items</a>
  I need read whole list of this items (name, priece, icon) showing them like list view.
  Problem is that i need modify url to specific item like:
  <a href="https://api.guildwars2.com/v2/items/256" rel="nofollow">https://api.guildwars2.com/v2/items/256</a>
  Is possible to acces to all items once?
  My code :</p>
  
  <pre><code>package com.wingnity.jsonparsingtutorial;
  
  import java.io.IOException;
  import java.util.ArrayList;
  
  import org.apache.http.HttpEntity;
  import org.apache.http.HttpResponse;
  import org.apache.http.client.HttpClient;
  import org.apache.http.client.methods.HttpGet;
  import org.apache.http.impl.client.DefaultHttpClient;
  import org.apache.http.util.EntityUtils;
  import org.json.JSONArray;
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import android.app.Activity;
  import android.app.ProgressDialog;
  import android.content.Intent;
  import android.net.ParseException;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.Toast;
  import android.widget.AdapterView.OnItemClickListener;
  import android.widget.ListView;
  
  public class MainActivity extends Activity {
  
  ArrayList&lt;Actors&gt; actorsList;
  
  ActorAdapter adapter;
  
  @Override
  protected void onCreate(Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      actorsList = new ArrayList&lt;Actors&gt;();
      new JSONAsyncTask().execute("https://api.guildwars2.com/v2/items");
  
      ListView listview = (ListView)findViewById(R.id.list);
      adapter = new ActorAdapter(getApplicationContext(), R.layout.row, actorsList);
  
      listview.setAdapter(adapter);
  
      listview.setOnItemClickListener(new OnItemClickListener() {
  
          @Override
          public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position,
                  long id) {
              // TODO Auto-generated method stub
              Toast.makeText(getApplicationContext(), actorsList.get(position).getName(), Toast.LENGTH_LONG).show();              
          }
      });
  }
  
  
  class JSONAsyncTask extends AsyncTask&lt;String, Void, Boolean&gt;
  {
  
      ProgressDialog dialog;
  
      @Override
      protected void onPreExecute()
      {
          super.onPreExecute();
          dialog = new ProgressDialog(MainActivity.this);
          dialog.setMessage("Wczytywanie prosze czekac");
          dialog.setTitle("Polaczenie z serwerem");
          dialog.show();
          dialog.setCancelable(false);
      }
  
      @Override
      protected Boolean doInBackground(String... urls)
      {
          try {
  
              //------------------&gt;&gt;
              HttpGet httppost = new HttpGet(urls[0]);
              HttpClient httpclient = new DefaultHttpClient();
              HttpResponse response = httpclient.execute(httppost);
  
              // StatusLine stat = response.getStatusLine();
              int status = response.getStatusLine().getStatusCode();
  
              if (status == 200)
              {
                  HttpEntity entity = response.getEntity();
                  String data = EntityUtils.toString(entity);
  
  
                  JSONObject jsono = new JSONObject(data);
                  JSONArray jarray = jsono.getJSONArray("256");
  
                  for (int i = 0; i &lt; jarray.length(); i++)
                  {
                      JSONObject object = jarray.getJSONObject(i);
  
                      Actors actor = new Actors();
  
                      actor.setName(object.getString("name"));
                      actor.setDescription(object.getString("description"));
                      actor.setDob(object.getString("type"));
                      actor.setCountry(object.getString("level"));
                      actor.setHeight(object.getString("rarity"));
                      actor.setSpouse(object.getString("vendor_value"));
                      actor.setChildren(object.getString("default_skin"));
                      actor.setImage(object.getString("icon"));
  
                      actorsList.add(actor);
                  }
                  return true;
              }
  
              //------------------&gt;&gt;
  
          } catch (ParseException e1)
          {
              e1.printStackTrace();
          } catch (IOException e)
          {
              e.printStackTrace();
          } catch (JSONException e)
          {
              e.printStackTrace();
          }
          return false;
      }
  
      protected void onPostExecute(Boolean result)
      {
          dialog.cancel();
          adapter.notifyDataSetChanged();
          if(result == false)
              Toast.makeText(getApplicationContext(), "Unable to fetch data from server", Toast.LENGTH_LONG).show();
  
      }
  }
  </code></pre>
  
  <p>}</p>