I am trying to add some sleep-time in my Asynctask because right now my ProgressDialog is too fast when there isn't much data to load.
I tried this:
@Override
protected Boolean doInBackground(Void... params) { try { progressDialog.setMessage("Loading first thing..."); firstThing(); progressDialog.incrementProgressBy(1); Thread.sleep(500); //...repeat above four lines a few times for second, third, fourth thing, etc return true; } catch (Exception e) { Log.e("MyClassName", "There was an error: " + e); }
}
I am getting the error "Only the original thread that created a view can touch its views."