Error using Thread.sleep in an Asynctask

ساخت وبلاگ

Vote count: 0

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."

asked 19 secs ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : نویسنده : استخدام کار backsoft بازدید : 359 تاريخ : جمعه 23 مهر 1395 ساعت: 14:58