title: ListView items sort/reorder and saving changes?
body: <p>I have a <code>ListView</code> and I can reorder items, but every time I exit from the app and start it again the order goes back to default. I'd appreciate if someone can give me answer and maybe a little snippet of how I can do that.</p>
  
  <p>Example: I have two items and two links. Google and Yahoo. I use drag and drop and <code>ArrayList</code> with that. Everything is fine except I don't know how to save the new order.</p>
  
  <p>I don't know if there is some other way to reorder those items.</p>
  
  <p>I use CWAC-TOUCHLIST to do this.</p>
  
  <p><strong>Here is how far I have got:</strong></p>
  
  <pre><code>    private static String[] items={"Google", "Yahoo"};
  
      private static String[] links={"http://google.com", "http://yahoo.com"};
  
      private IconicAdapter adapter=null;
  
      private IconicAdapter1 adapter2=null;
  
      ArrayList&lt;String&gt; array= new ArrayList&lt;String&gt;(Arrays.asList(items));
  
      private ArrayList&lt;String&gt; array2=
          new ArrayList&lt;String&gt;(Arrays.asList(links));
  
     /** Called when the activity is first created. **/
     @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          TouchListView tlv=(TouchListView)getListView();
          adapter=new IconicAdapter();
          adapter2=new IconicAdapter1();
              setListAdapter(adapter);
          setListAdapter(adapter2);
  
          tlv.setOnItemClickListener(itemclick);
          tlv.setDropListener(onDrop);
  
     }
  
      private TouchListView.DropListener onDrop =
          new TouchListView.DropListener() {
              @Override
              public void drop(int from, int to) {
                  String item=(String) adapter.getItem(from);
  
                  adapter.remove(item);
                  adapter.insert(item, to);
  
                  String link=(String) adapter2.getItem(from);
                  adapter2.remove(link);
                  adapter2.insert(link, to);
              }
          };
  
      private TouchListView.OnItemClickListener itemclick =
          new TouchListView.OnItemClickListener(){
              public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                  int from, long id) {
  
                  String item = adapter.getItem(from);
  
              Toast.makeText(getBaseContext(), "you pick: "+item,
                          Toast.LENGTH_SHORT).show();
  
                  String link = adapter2.getItem(from);
                  Intent showContent = new Intent(getApplicationContext(),
                          Web.class);
                  showContent.setData(Uri.parse(link));
                  startActivity(showContent);
              }
          };
  </code></pre>
  
  <p>Is there a smarter way to do it?</p>