Why does anyDensity="true" kill performance on android

You must Login before you can answer or comment on any questions.

Hi,

I touched on this on a previous post about something else, but I just would like to flag to get thoughts from people, or to see if people even realise.

While building in appcelerator I had the anyDensity setting in the tiapp.xml set to true on android (bearing in mind I hadn't seen any reference to using dp's on android versus pixels or advantages/disadvantages of it though after digging I did find references to using dp's on android instead), I noticed that the performance between iOS and android was quite noticeable in that:

  • Tableviews were choppy/slow
  • Scrolling in general was slower
  • Map view was very choppy with numbers of markers added. Plus it appeared pixellated at points -- ie- the 'your location' beacon was pixellated
  • Swiping between scrollableView's was noticeably choppy etc etc etc

It was only upon accidentally while working out how to get high density images in android did I stumble across changing this setting. Naturally at this point, and every example app I'd seen from appcelerator, that all my positionings/sizings were just as standard numbers (defaulting to pixels), so the first thing I see when turning off the anyDensity setting is the layout became tiny (but images were now crisp). But then I noticed something.

Suddenly, the performance of the app went through the roof, everything was buttery smooth as I imagined it should have been, table's glide, scrolling flows, map views pan like butter, scroll views whoosh.

I then go through the laborious process of specifying all the values in dp's for android and my app looks how it should be again, but the performance is top notch.

So my questions are:

a) Why is anyDensity making performance become awful -- I'm assuming it's the whole scaling things up b) Why do -all- appcelerator's guides/examples not use dp's or set the anyDensity to false c) Why isn't something that has such a detrimental impact on performance not underscored, flagged, made very clear from the offset d) Am I missing something, does everybody know this already or have I just fallen foul of some appcelerator joke!

— asked 10 months ago by Adam Hartwig
2 Comments
  • Damn where's the edit button. Meant to say it's when anyDensity="false" that the performance becomes poor.

    — commented 10 months ago by Adam Hartwig

  • Any answers to this question yet?

    — commented 7 months ago by Patrick Lind

Your Answer

Think you can help? Login to answer this question!