Java – the best way to thread in Android?

I have an animation that triggers an event This event will trigger a lot of computing usage, thus breaking the UI

What I need to do is keep the thread running smoothly When an event occurs, it passes the string to the thread, performs calculations (including using the audiorecord class) and returns a boolean variable

I look around and it seems that asynctask may be the best solution, but I want to see if there are any ideas among you? Considering performance, is this the best way?

thank you,

book

Solution

Usually asynctask is very good

new Thread(new Runnable() {
    public void run() {
        //do stuff
    }
}).start();
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>