How to get the image from the fileDescriptor

I have a image like a fileDescriptor in the fileStorage. How Can I use this image in the MainScreen?.
This code doesn’t work

FileDescriptor imageFile = empresa.getLogo();

I need know to get the image form the fileDescriptor.
Thank you

What is the problem in detail? Image is not displayed, or an error in the code?

The code snippet you’ve presented looks correct.

Hi Alexander,
I get this error

OK, this error happens when empresa object was loaded from DB without associated logo attribute.

CUBA doesn’t have lazy loading of not loaded attributes. Instead, loading is regulated with the concept of “views”.
The view used to load empresa from database - should be extended with logo attribute.
So you need to find out in the code, where empresa comes from.
If it is taken from some data container - then the view is declared in the container, in XML descriptor.

If it’s taken from some service or loaded with DataManager - then the view used with DataManager.load() or loadList() method should be extended with necessary property.

Some examples are presented here: Creating Views - CUBA Platform. Developer’s Manual