title: How to set Arraylist value static in android
body: <p>I have added in <code>Array List&lt;String&gt;dynamically</code> get all data from web service .I need last position statically added. How to make it?</p>
  
  <pre><code>arrayAdapter = new ArrayAdapter&lt;String&gt;(MainActivity.this,
  android.R.layout.simple_list_item_1, arrListViewcuisine);
  lv.setAdapter(arrayAdapter);
  
  enter code here
  
      try {
              JSONArray json = new JSONArray(result);
  
              // JSONArray post = json;
  
              for (int i = 0; i &lt; json.length()+1; ++i) {
                  if(i==json.length())
                  {
                      JSONObject rec1 = json.getJSONObject(i);
  
                      arrlistdatacuisine.add(i, rec1.getString("cuisine"));
                  }
                  else
                  {
                      JSONObject rec1 = json.getJSONObject(i);
                      arrlistdatacuisine.add(i,"All Resturent");
                  }
  
  
              }
  
  
              arrListViewcuisine = (ArrayList&lt;String&gt;) arrlistdatacuisine
                      .clone();
              Collections.sort(arrListViewcuisine);
              arrayAdapter = new ArrayAdapter&lt;String&gt;(MainActivity.this,
                      android.R.layout.simple_list_item_1, arrListViewcuisine);
              lv.setAdapter(arrayAdapter);
  </code></pre>
  
  <p>enter code here
              } catch (Exception e) {<code>enter code here</code>
                  // TODO: handle exception
              }</p>