Worker Class outside ui thread
<p>I have to make a <strong>massive sql manipulation</strong> (too many inserts) at the beginning of the app. I have a splash screen like this. </p>

<pre><code>public class SplashScreen extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ...
    }

    @Override
    protected void onResume() {
        super.onResume();
        ...
        new SetupDataBaseWorker(this).execute();
    }
    private class SetupDataBaseWorker extends AsyncTask&lt;Void, Void, Void&gt; {
        private SqliteManager db_sql;
        private Activity activity;

        public SetupDataBaseWorker(Activity activity) {
            this.activity = activity;

            db_sql = new SqliteManager(this.activity);
        }

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            ...
            showDialogLoading();
            ...
        }

        @Override
        protected Void doInBackground(Void... urls) {
            ...
            db_sql.inserting();
            ...
            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            super.onPostExecute(result);

            this.activity.startActivity(new Intent(SplashScreen.this, MainActivity.class));
            this.activity.finish();
        }
    }
}
</code></pre>

<p>1- Always at the first running (after install), i got a blank screen for 10 seconds (i suppose that's the script running...), and after, my app goes to the mainActivity.</p>

<p>2- If i run the app a second time, it shows a blank screen for 1 seconds and goes to the MainActivity (Don't even shows the SplashScreen layout).
It seems that the worker class it's not working outside the ui thread at all... What i have to do to accomplish that? I already tried put this worker at a Service, but still the same.</p>