让BroadcastReceiver的onReceive()运行于非主线程的方法

HandlerThread handlerThread = new HandlerThread("xx");
handlerThread.start();
registerReceiver(mReceiver,
        new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE),
        null,
        new Handler(handlerThread.getLooper()));


你可能感兴趣的:(android,ANR)