I am using a worker thread, as described here but still the code is blocking the UI. If I sleep at the beginning of the run() method, it doesn't block the UI. The thing is, it's a heavy code that runs from the onCreate method, but no matter what I do, I can't make it not block the UI. What am I doing wrong?
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < 1000000; i++) {
Log.d("asdf", "asdf");
}
}
}).start();
}