How can you detect a dual-core cpu on an Android device from code?

前端 未结 6 1829
小鲜肉
小鲜肉 2020-11-29 23:42

I\'ve run into a problem that appears to affect only dual-core Android devices running Android 2.3 (Gingerbread or greater. I\'d like to give a di

6条回答
  •  借酒劲吻你
    2020-11-30 00:14

    You can try using Runtime.availableProcessors() as is suggested in this answer

    Is there any API that tells whether an Android device is dual-core or not?

    ---edit---

    A more detailed description is given at Oracle's site

    availableProcessors

    public int availableProcessors()
    

    Returns the number of processors available to the Java virtual machine.

    This value may change during a particular invocation of the virtual machine. Applications that are sensitive to the number of available processors should therefore occasionally poll this property and adjust their resource usage appropriately.

    Returns:

    the maximum number of processors available to the virtual machine; never smaller than one

    Since:

      1.4
    

提交回复
热议问题