How to know when SQLite query is finished
<p>Ok, I've got this Retrofit Call that receives a list of objects and insert the into a local SQLite database. I want to display a message saying that the operation was successful with a Ok button that when pressed opens a new activity.</p>

<p>How do I check if my Query has finished so I can show the message?</p>

<pre><code>final ContactApi contactApi = retrofit.create(ContactApi.class);

Call&lt;List&lt;Contact&gt;&gt; callContact = contactApi.getContact(token);
callContact.enqueue(new Callback&lt;List&lt;Contact&gt;&gt;() {
    @Override
     public void onResponse(Response&lt;List&lt;Contact&gt;&gt; response, Retrofit retrofit) {

        List&lt;Contact&gt; contactList = response.body();

        if (contactList != null) {

            try {

                DBHelper dbHelper = new DBHelper(TokenActivity.this, token);
                SQLiteDatabase conn = dbHelper.getWritableDatabase();
                RepoContact repocontact = new RepoContact(conn);

                // Inserts each contact into the database
                    for (Contatc c : contactList) {

                        repositorioCadastro.inserirCadastro(c);

                        Log.i("ACTTOKEN", "Contact insert ID: " + c.getId());

                    }

            } catch (SQLiteException e) {
             Log.i("ACTTOKEN", "Faillure on insert: " + e.getMessage());
            }
</code></pre>

<p>}</p>