Free resource

How can i free a resource?

I am loading bitmap resources as I need them to display a time, i.e 1.bmp, 2.bmp etc

So if it's 11:12 I load 1.bmp and 2.bmp

But when it's 11:13 I want to free 2.bmp

Thanks!
  • Assign all references to the resource to null (or some other object)

    var resource = Ui.loadResource(Rez.Bitmaps.Digit1);

    // allocate Digit1, free Digit2
    resource = Ui.loadResource(Rez.Bitmaps.Digit2);

    // free Digit2
    resource = null;