Usama Sarwar
Usama Sarwar

Reputation: 9020

Turn on "Force Gpu Rendering " programmatically

The minSdk version for my app is 7, my app runs smooth on nexus with ICS as compared to the versions below 3.0, since the min sdk is 7 so i want to switch on gpu rendering option programatically if it is already not enabled for versions above 3.0, ho can i make my app compatible with 2.0 to onward i.e enable gpu rendering option for OS>=3.0 only. I want to enable the rendering at the application level, not only at the view level

Upvotes: 1

Views: 3323

Answers (1)

David Scott
David Scott

Reputation: 1666

Add android:hardwareAccelerated="true" to the application tag of your manifest. It will be ignored by pre Honeycomb devices. Make sure your target sdk is honeycomb or later.

You will need to check that you are not using apis that are for a higher level, but it is not a massive problem. You can get around it with reflection for more complicated tasks or simply by using an if statement, like:

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
}

There is some more details about this here

Upvotes: 3

Related Questions