call public class and refresh list view in the activity
<p>i have a MainActivity with a list view.
in this activity is a <code>private void showList()</code> which query all of my database and show it in the list view.</p>

<p>i have another public class "Sync" which send an http post to my MYSQL Database, get the result and write this into the android database.</p>

<p>i would like to realize, that on each resume of the main activity, the public class Sync will call and on finish the list view in the main activity should be refresh.</p>

<p>in the MainActivity, i call it like this:</p>

<pre><code>@Override
public void onResume() {
   super.onResume();
   new Sync.SyncMYSQL(context).execute();
}
</code></pre>

<p>this is the Sync Class:</p>

<pre><code>public class Sync {


        // MYSQL =&gt; Database
        static class SyncMYSQL extends AsyncTask&lt;String, String, String&gt; {

            Context context;

            public SyncMYSQL(Context c) {
                this.context = c;
            }


            @Override
            protected String doInBackground(String... params) {
                try {

                       // DO SOMETHING


                } catch (MalformedURLException e) {
                    Log.e("--&gt;", Log.getStackTraceString(e));
                } catch (IOException e) {
                    Log.e("--&gt;", Log.getStackTraceString(e));
                }
                return null;
            }


            protected void onPostExecute(String result) {

                // DO SOMETHING

            }
        }
</code></pre>

<p><strong>MainActivity</strong></p>

<pre><code>public class OverviewData extends Fragment {

    private View FragementView;
    DatabaseHandler dbHandler;
    ListView ListView;
    DatabaseListAdapter databaseListAdapter;
    Context context;


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        context = getContext();

        FragementView = inflater.inflate(R.layout.overview, container, false);
        ListView = (ListView) FragementView.findViewById(R.id.listView);

        dbHandler = new DatabaseHandler(getActivity());

        showList();

        return FragementView;
    }


    @Override
    public void onResume() {
        super.onResume();
        new Sync.SyncMYSQL(context, 0).execute();
    }




    private void showList() {

        ArrayList&lt;DatabaseListItems&gt; databaseList = new ArrayList&lt;&gt;();
        databaseList.clear();

        String query = "SELECT * FROM " + DatabaseHelper.DATABASE_TABLE;

        Cursor c1 = dbHandler.selectQuery(query);
        if (c1 != null &amp;&amp; c1.getCount() != 0) {
            if (c1.moveToFirst()) {
                do {
                    DatabaseListItems databaseListItems = new DatabaseListItems();

                    databaseListItems.setIdentifier(c1.getString(c1.getColumnIndex(DatabaseHelper.COLUMN_ID)));

                    databaseList.add(databaseListItems);

                } while (c1.moveToNext()) ;
            }
            c1.close();

        }


        databaseListAdapter = new DatabaseListAdapter(getActivity(), databaseList);
        ListView.setAdapter(databaseListAdapter);
    }
}
</code></pre>