Running ExtractDecodeEditEncodeMuxTest outside of testcase on Android

狂风中的少年 提交于 2019-12-02 07:24:25

morelikely you need to run it in separate thread

    public static void runTest(ExtractDecodeEditEncodeMuxTest test) throws Throwable {
        test.setOutputFile();
        TestWrapper wrapper = new TestWrapper(test);
        Thread th = new Thread(wrapper, "codec test");
        th.start();
        th.join();
        if (wrapper.mThrowable != null) {
            throw wrapper.mThrowable;
        }
    }

Thank's to fadden, I was able to resolve this issue. I am using an intent service now and start a thread without looper there, which works fine.

For running the code in an Android service, this means that the wrapping thread has to be started from a custom thread. Starting a thread within a thread is probably not the very best solution, but it actually solves the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!