# NPE on new nUIViewDisplay(NUIID);

**URL:** <https://techcommunity.softwareag.com/t/npe-on-new-nuiviewdisplay-nuiid/100336>\
**Category:** Forum\
**Tags:** mobile\
**Created:** [February 8, 2012, 3:34pm UTC](https://techcommunity.softwareag.com/t/npe-on-new-nuiviewdisplay-nuiid/100336 "2012-02-08T15:34:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [February 8, 2012, 3:34pm UTC](https://techcommunity.softwareag.com/t/npe-on-new-nuiviewdisplay-nuiid/100336/1 "2012-02-08T15:34:00Z")

</div>

Hi everyone,

we have some unit tests that check whether our view layouts are correct.  
For that purpose we create nUIViewDisplay instances and assert their elements.  
This scheme was working for some time, but now the tests fail due to NPE on new nUIViewDisplay(id);  
At some point in the creation of the view, nUIController.getScreenWidth() is called, where the canvas\_interface variable is not initialized which results in NPE.  
We use junit4.

Is this expected behavior?  
Do we need to change the tests or the way they are executed?

Thanks,  
Evgeni

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [February 8, 2012, 4:33pm UTC](https://techcommunity.softwareag.com/t/npe-on-new-nuiviewdisplay-nuiid/100336/2 "2012-02-08T16:33:50Z")

</div>

Hi Evgeni,

I assume this is on the desktop using Phoney? Setting up nUI components before the CanvasInterface has been added will always be problematic. We can look to patch that functionality so it doesn’t throw an Exception, but the generated View will likely have some of its internal set up incorrectly for future real use.

Regards,

Nick.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:01pm UTC](https://techcommunity.softwareag.com/t/npe-on-new-nuiviewdisplay-nuiid/100336/3 "2021-04-02T15:01:51Z")

</div>

Closed on April 2, 2021, 3:01pm UTC


