Reputation: 7577
I want my animations in android 4.0 is very slow and lacks. So I want to enable hardware acceleration and have tried to do what this page says but with no luck.
You can see my manifest here:
<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionCode="1" android:versionName="1.0"
package="com.jws.battleship" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:hardwareAccelerated="true">
<activity
android:label="@string/app_name"
android:name=".HomeActivity"
android:hardwareAccelerated="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".UserPreferences"/>
<activity android:name=".BattleActivity" android:screenOrientation="landscape"/>
<activity android:name=".HighScoreActivity"/>
<activity android:name=".StoreActivity"/>
<activity android:name=".JoinBattle"/>
<activity android:name=".CreateBattleActivity"/>
<activity android:name=".FriendList"/>
<activity android:name=".FriendListActivity"/>
<activity android:name=".SelectNetworkActivity"/>
<activity android:name=".BluetoothDevicesListActivity"/>
<activity android:name=".NetworkFactoryActivity"/>
</application>
</manifest>
I then test if it has enabled hardware acceleration in onCreate() like this:
ListView list = (ListView)findViewById(R.id.home_list_active_games);
Boolean test = list.isHardwareAccelerated();
But it always returns false!? Do I need to add some kind of permission or what is wrong here?
BR
Upvotes: 7
Views: 15148
Reputation: 11
Change this to
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="15"/>
Using hardware acceleration requires minSdkVersion 11 or higher.
Upvotes: 1
Reputation: 31252
The above code looks ok. The same problem is posted at HoneyComb isHardwareAccelerated() always returns false. Yet Android 3.0 Hardware Acceleration writes
If you need more fine-grained control, you can enable hardware acceleration for a given window at runtime:
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
Upvotes: 5