How do I restore a deleted multi-image

时间:2016-10-20 18:39:39

标签: codenameone

I accidentally deleted a multi-image entry from the list in the Codename One theme designer and can no longer access the image from code (I get a NullPointerException) or the Designer & GUI Editor. The folder with the scaled images is still located in the res/theme folder for the project.

I would like to restore this entry in the list but every option I can find to add a multi (or any) image doesn't seem to be able to handle this case. How can I add a multi-image folder to the resource list?

1 个答案:

答案 0 :(得分:2)

Follow these steps to solve this:

  1. Cut that multi-image folder and paste somewhere out of the res folder.
  2. In your theme designer, add a dummy multi-image and rename it to match your required multi-image's name.
  3. Save your theme designer and close it, now go to your res folder and delete the newly created multi-image folder that matches the name of the original one and copy the previous one you paste somewhere into the folder.
  4. Open your theme.res and save again.

EDIT: Second method:

Check XML Team Mode under File in your theme designer, close the designer without saving anything.

Make sure your multi-image folder is located in the res folder. Go to Netbeans and switch the projects navigation tab to Files and look for theme.xml under your project files tree and double click to edit, now add the below code right after <resource majorVersion="1" minorVersion="7" useXmlUI="false">

<image name="my-image-name.png" type="multi"  />

Substitute your image name as necessary. Save the xml file and close it, then reopen your theme.res and change anything just to create a new "Save" .