Setting android:hardwareAccelerated=“true” in or in

Setting android:hardwareAccelerated=“true” in <activity> or in <application>



I want my app, which relies heavily on GPU, to use hardware acceleration. On some forums I've been suggested to set android:hardwareAccelerated="true" inside <application> and on other forums same attribute inside <activity> inside my AndroidManifest.xml. Below is the representation of what it looks like:


android:hardwareAccelerated="true"


<application>


<activity>


AndroidManifest.xml


<application
...
android:hardwareAccelerated="true"
...>
<activity
...
android:hardwareAccelerated="true"
...>
</activity>
</application>



I ended up setting in both, yet I wonder, which one is the right way, and what is the difference?





Better use it in lower resolution (view) and not for whole application.
– RonTLV
Aug 30 at 7:57





2 Answers
2



Hardware acceleration is enabled by default so you don't have to set it unless you need to disable it. As said in the documentation:



Hardware acceleration is enabled by default if your Target API level is >=14, but can also be explicitly enabled.



To answer your question. Setting it on Application tag affects your whole application and setting it on Activity tag affects that activity.



In your Android manifest file, add the following attribute to the tag to enable hardware acceleration for your entire application:


<application android:hardwareAccelerated="true" ...>



If your application does not behave properly with hardware acceleration turned on globally, you can control it for individual activities as well. To enable or disable hardware acceleration at the activity level, you can use the android:hardwareAccelerated attribute for the element. The following example enables hardware acceleration for the entire application but disables it for one activity:


<application android:hardwareAccelerated="true">
<activity ... />
<activity android:hardwareAccelerated="false" />
</application>



If you set on <application> it means that the whole app has the hardwareAccelerated feature and you don't need to set it again on <activity>, but if your application does not behave properly with hardware acceleration turned on globally, you can set it on <activity>, and it means only that specific activity has the feature hardwareAccelerated and not the whole app. So I think on your case, you can set it only on <application> tag.


<application>


hardwareAccelerated


<activity>


<activity>


hardwareAccelerated


<application>



See more here.
https://developer.android.com/guide/topics/graphics/hardware-accel



Required, but never shown



Required, but never shown






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế