title: Refresh an Arraylist
body: <p>I have my <code>arraylist</code> taking my data from my sqlite database, when i deleted the data inside the sqlitedatabase i want to refresh the list i did this but it crash:</p>
  
  <pre><code>    SQLiteDatabase db;
          ListView lv;
          ArrayList&lt;String&gt; your_array_list  = new ArrayList&lt;String&gt;();
          ArrayAdapter&lt;String&gt; arrayAdapter;
  
  
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_historique);
              db=openOrCreateDatabase("Site2", Context.MODE_PRIVATE, null);
              db.execSQL("CREATE TABLE IF NOT EXISTS story2(_id INTEGER PRIMARY KEY,adresse VARCHAR);");
              Cursor cursor = db.rawQuery("select * from story2",null);
              lv = (ListView) findViewById(R.id.listView);
              lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                  @Override
                  public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
                      long clic= id+1;
                      Cursor c2 = db.rawQuery("SELECT * FROM story2 where _id="+clic+"", null);
  
  
  
                      if (c2.moveToFirst()){
                          do{
                              String site =c2.getString(1);
                              Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(site));
                              startActivity(browserIntent);
  
  
                          }while(c2.moveToNext());
                      }
                      c2.close();
                  }
  
  
              });
  
              // Instanciating an array list (you don't need to do this,
              // you already have yours).
              List&lt;String&gt; your_array_list = new ArrayList&lt;String&gt;();
  
  
              // This is the array adapter, it takes the context of the activity as a
              // first parameter, the type of list view as a second parameter and your
              // array as a third parameter.
              ArrayAdapter&lt;String&gt; arrayAdapter = new ArrayAdapter&lt;String&gt;(
                      this,
                      android.R.layout.simple_list_item_1,
                      your_array_list );
  
              lv.setAdapter(arrayAdapter);
              if(cursor.moveToFirst())
  
              {
                  do {
                      your_array_list.add(cursor.getString(1));
  
  
  
  
                  } while (cursor.moveToNext());
              }cursor.close();
          }
  
  
  
          @Override
          public boolean onCreateOptionsMenu(Menu menu) {
              // Inflate the menu; this adds items to the action bar if it is present.
              getMenuInflater().inflate(R.menu.menu_historique, menu);
              return true;
          }
  
          @Override
          public boolean onOptionsItemSelected(MenuItem item) {
              // Handle action bar item clicks here. The action bar will
              // automatically handle clicks on the Home/Up button, so long
              // as you specify a parent activity in AndroidManifest.xml.
              int id = item.getItemId();
  
              //noinspection SimplifiableIfStatement
              if (id == R.id.action_settings) {    
                  db.execSQL("DELETE FROM story2");
                  arrayAdapter.notifyDataSetChanged();
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>i think it's because i'am refreshing the <code>adapter</code> but i didn't do anything to it</p>