How to optimize Android apps for multiple cores

With Android phones with multiple cores, application developers can verify that their application uses the extra processing power of these cores. As far as I understand, the only thing application developers can do is make their application multithreaded and let the android kernel take care of delegating tasks on different kernels.

I would like to know if there is anything else that can be done to optimize for multiple cores. Also what are the best multithreading methods in android.

+5
source share
1 answer

Instead of trying to stream yourself, it's best to use built-in paradigms such as AsyncTask.

//Sets up a thread pool where NUM_THREADS is the amount that can run at the same time
ExecutorService threadPool = null;
threadPool = Executors.newFixedThreadPool(NUM_THREADS);

//Will execute something on one of the threads queuing if necessary
threadPool.execute(new Runnable() {
    @Override
    public void run() {

                      }});

-

+2

All Articles