Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2388] Java Exception Error : Titanium.Platform.displayCaps.platformWidth

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-04-19T23:32:31.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelstriage
Reportermutturaj
AssigneeMauro Parra-Miranda
Created2012-10-04T06:54:48.000+0000
Updated2016-03-08T07:41:25.000+0000

Description

We have designed custom Dashboard view for android, we are using platformwidth and height property to get the screen width and height. But we are encountering Uncaught Java Exception : Titanium.Platform.displayCaps.platformWidth when we change android device orientation. Kindly check ASAP.

Attachments

FileDateSize
titanium_platformWidth_error.png2012-10-04T06:54:48.000+0000280585

Comments

  1. Daniel Sefton 2012-10-04

    Hi mutturaj, Is it possible for you to provide a reproducible test case in the form of an app.js? I also need you to add the Titanium Mobile SDK version you are building against, and the Android OS version. Thanks.
  2. Daniel Sefton 2013-01-25

    I've set this to resolved so that the issue can now be edited to provide more info. We appreciate your time in helping to improve our platform. Thanks, Daniel
  3. Michael Williams 2013-04-17

    I can confirm this problem. For me it just randomly shows this message when accessing the property, but it not always fails. Lets say 1 in 100 times this error occurs *. Just run this a thousand times to test: alert(Titanium.Platform.displayCaps.platformWidth); It for sure happens in SDK: 3.0.2.GA Maybe it is fixed in the new SDK 3.1.0, It's not easy to test, because in my case there is no noticeable reason.
  4. Daniel Sefton 2013-04-19

    Hi Michael, I tried this code with 3.1 GA... It never seems to fail for me. Please try with 3.1 GA and let me know how it goes.
    var win = Ti.UI.createWindow({
       	backgroundColor : "#FFF"
       });
       win.addEventListener('click', function(e) {
       	alert(Titanium.Platform.displayCaps.platformWidth);
       });
       win.open();
    Thanks.
  5. Gilberto Avalos 2013-06-10

    I get this error randomly, but most of the time. function tabWidth() { return Ti.Platform.displayCaps.platformWidth / 2; }
  6. Daniel Sefton 2013-06-11

    Did you try my test case? Which Ti SDK version?
  7. Gilberto Avalos 2013-06-11

    The error occurs when the application is initialized from a uri with a intent filter, here is the code: https://github.com/appcelerator-titans/App/blob/master/Community/Resources/android/ui/TabStripView.js SDK Version: 3.1.0.GA
       <activities>
         <activity url="app.js">
           <intent-filter>
             <data android:scheme="cascanner"/>
             <action android:name="android.intent.action.MAIN"/>
             <category android:name="android.intent.category.DEFAULT"/>
             <action android:name="android.intent.action.VIEW"/>
             <category android:name="android.intent.category.BROWSABLE"/>
           </intent-filter>
         </activity>
        </activities>
       
       <a href="cascanner://type=CE&client_code=5708232">Test</a>
       
  8. Soumya Kanti Kar 2013-06-21

    We are also facing the similar issue and it is very random. We have got it once twice till now in 1.5 month. But we are unable to create a reproducible test case for this. But this is existing and extremely rare. Gilberto, Can you please explain as to what did you mean by application initialized URI. Above is the intent filters that we are using for our app. We are testing it with 3.1.0GA

JSON Source