I am developing an Android game, in which a ball (bitmap) translates( is in motion). So I have provided motion equations for the ball. I have checked my app on Samsung galaxy S2 whose actual density is roundly 252 dpi, and It works fine on that. So my question is that Does these motions of bitmaps in surfaceView, depends on actual density of phone( i.e 252 dpi for S2) or generalized density(i.e 240 dpi).

I am confused whether if I run this app on 235 dpi smartphone, So will it have the same performance of motion as it is on Galaxy S2( with 252 dpi) or it would be little slow ?

Any help will be appreciated.

Let me elaborate it with coding. For example a linear motion of a ball is defined as with this equation x=x+4; Now If I run this app, on Samsung galaxy S2(252dpi, and hdpi), So It will give me a particular speed motion, let say P is the speed of the ball. Now If I run this application on Samsung Galaxy S3(300+ dpi, xhdpi), So the ball speed gonna be slow on this density, meaning less than the speed P.

So I will need the same speed on xhdpi density phone. So will use these conversion formulas ; dx= (x*160)/240; px= (dx*320)/160; Hence the speed will be either exact or little different from P.(This is my confusion). That Whether the speed will be as same as it was on S2.

So my Question at this point is that my app worked on Samsung Galaxy S2 with the speed p, that I desired. As S2 is of 252 dpi, So Should I Include 240(Generalized density or 252 (Actual density) in my this line of coding ? dx= (x*160)/240;

Thanks !

  • \$\begingroup\$ Why should it have a different performance? Or did I get it wrong? \$\endgroup\$ – alecnash Oct 25 '12 at 12:31
  • \$\begingroup\$ That is actually my question that whether the android uses general density or actual density throughout the applications ? \$\endgroup\$ – Asghar Shah Oct 25 '12 at 15:20
  • \$\begingroup\$ Did you get my question or Should I elaborate it with coding ? \$\endgroup\$ – Asghar Shah Oct 25 '12 at 15:21
  • \$\begingroup\$ Just to make it completely clear, you aren't using opengl are you? And, when you talk about different performance, you mean different speed right? Cause it's not the same thing... \$\endgroup\$ – jmacedo Oct 25 '12 at 18:04
  • \$\begingroup\$ @joxnas Yes I am concerned with speed, and I am using surfaceview with canvas drawing rather than opengl. I have edited my post now and my question is explained through coding. Could you help me now ? \$\endgroup\$ – Asghar Shah Oct 25 '12 at 21:34

You can call the getDensity method on your Canvas. This will tell you what Android is doing. To test performance, I would try your app on a couple different phones. I'm in a Android development Meetup group, and we help each other out by testing apps on difference devices. If this isn't possible, you could setup different AVD targets with differing densities. While this won't show you the performance, it will tell you what Android is doing with densities. There is a good article on the Android developer site that talks about supporting multiple screen sizes & densities: http://developer.android.com/guide/practices/screens_support.html

| improve this answer | |
  • \$\begingroup\$ Cool. How can you test it on different phones ? I have my game live on google play now. Besides this it is also available on Slideme.org \$\endgroup\$ – Asghar Shah Oct 26 '12 at 11:43
  • \$\begingroup\$ I have some friends that let me install my "works in progress" on their devices. In our meetup group, we post the APK file to a server and email the group with the URL. Some will download your program. I use a tool like ACRA (acra.ch) to collect metrics from them automatically. \$\endgroup\$ – amb Oct 26 '12 at 13:05
  • \$\begingroup\$ One other thing...Check out this article about testing Android games: techcrunch.com/2012/06/02/android-qa-testing-quality-assurance \$\endgroup\$ – amb Oct 26 '12 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.