How to update ListView after updating database?
<pre><code>public class SettingsActivity extends AppCompatActivity {
private Context context;
private DogDatabaseHelper dbHelper;
private ListView mListView;
private ArrayList&lt;String&gt; names = new ArrayList&lt;String&gt;();
@Override
public void onCreate(Bundle savedInstance){
    super.onCreate(savedInstance);
    setContentView(R.layout.settings);
    mListView = (ListView)findViewById(R.id.listforall);
    context = this;

    DogDatabaseHelper dbHelper = new DogDatabaseHelper(getApplicationContext());
    SQLiteDatabase db = dbHelper.getWritableDatabase();
    Cursor cursor = db.rawQuery("select name from dog",null);
    int count = cursor.getColumnIndex("name");
    if(cursor.moveToFirst()){

        do{
            names.add(cursor.getString(cursor.getColumnIndex("name")));
        }while (cursor.moveToNext());
        AdapterForNames namesAdapter = new AdapterForNames(this,names);
        namesAdapter.notifyDataSetChanged();
        mListView.setAdapter(namesAdapter);

        mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int position, long id) {
                Intent intent = new Intent(SettingsActivity.this,SetupActivity.class);
                intent.putExtra("name",names.get(position));
                startActivity(intent);
            }
        });
    }
}
</code></pre>

<p>This is the <code>ListView</code> I'm using, but after getting database updated, I can't get my <code>ListView</code> refreshed, I guess i should put some code in restart method?  But not sure what to do. Any help?</p>