why bindservice still causes app ANR after moving it to a worker thread

Viewed 2637

I have a bindservice in onCreate that takes a long time, I tried to solve this problem by moving it to a worker thread, but it still causes the UI to wait. What can I do

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);


        new Thread(){
            public void run(){
                android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);

                Intent serviceIntent = new Intent(getApplicationContext(), Recognizer.class);
                bindService(serviceIntent, mConnection,Context.BIND_AUTO_CREATE);
            }
        }.start();
}
3 Answers
Related