[AC-2051] alloy/measurement pxToDP returns the same value on Android
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2014-02-03T17:34:11.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Alloy, Appcelerator Modules |
Labels | alloy, android, builtins, measurement, regression |
Reporter | Emanuele Salamone |
Assignee | Shak Hossain |
Created | 2014-02-03T10:28:49.000+0000 |
Updated | 2016-03-08T07:41:00.000+0000 |
Description
Using the function pxToDP on Titanium.Platform.displayCaps.platformWidth, on an Android Galaxy Nexus should return 360 (in dp).
Instead it's returning 720, that is the original pixel value.
I used the same module on previous Alloy versions and it worked.
Can't reproduce. I've just tested this on my Nexus 5 with this code (same environment):
It returned 360 as expected.
You're right, your code returns the expected result even to me (i made a new test project to test it). However, the usage inside my project returns the wrong result, and i'm not doing much more. I'll try to isolate the bug and be more detailed.
Nope, can't manage to understand what's happening. The same code that's working on the test project doesn't work when copied on my real project index.js. Additional info: i recently switched from Titanium 3.1.3 to Titanium 3.2.0, and it worked before. I don't know if this switch can somehow interfere with paths or other things.
Last comment: i copied my WHOLE project inside the test project folder. I compiled and then it worked, so i guess my project was somehow in a "dirty" state. Sorry for the false issue! Thanks for your help!
Closing on the basis of last comment by the reporter.
I've just had the same problem (a 3.1 project migrated to 3.2) and I found a nicer solution : Remove the "Resources" directory, and recompile it, it solves the problem for me.
I've just had the same problem (a 3.1 project migrated to 3.2) and I found a nicer solution : Remove the "Resources" directory, and recompile it, it solves the problem for me (Clean project doesn't solve it!)
Just faced this issue too! Strange thing. Suggested solution solved it for me too