title: How to save dynamically added items in Listview with sharedpreferences?
body: <pre><code>        protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      preferences = getSharedPreferences(FAVORI, 0);
  
      ListView favlist = (ListView) findViewById(R.id.favoriliste);
  
      ArrayList&lt;String&gt; foo = new ArrayList&lt;String&gt;();
      String [] bar = foo.toArray(new String[0]);
  
      public void favekle(String string) {
  
      foo.add(string);
      bar = foo.toArray(new String[0]);
  
      favadapter = new MyFavAdapter(Diziler.this,
              android.R.layout.simple_list_item_1, R.id.txtTitle, bar);
      // favlist= new ArrayList&lt;&gt;();
      favlist.setAdapter(favadapter);
      favadapter.notifyDataSetChanged();
  
  }       
      favadapter = new MyFavAdapter(Diziler.this,
              android.R.layout.simple_list_item_1, R.id.txtTitle, bar);
      // favlist= new ArrayList&lt;&gt;();
      favlist.setAdapter(favadapter);
      favadapter.notifyDataSetChanged();
  </code></pre>
  
  <p>Hello.I need help.I want save dynamically added items in Listview with SharedPreferences.
  I'm adding listview items with public void favekle function.I'm adding items to ArrayList&lt;>  than i convert ArrayList&lt;> to string array finally i set items to adapter.
  If i restart application my listview items disappear.
  How can i save added items with sharedpreferences?I used StringBuilder but it didn't work.Thank you.</p>