1

I've added images to my drawable folder, namely, I've changed the image icon.png from the default to my custom image. I've also added a screen.png image

however when I try to load the image: <Image src="res://icon"></Image>

I still see the old default icon.png image and when I change the image source to screen then I get LOG from device Nexus 6P: Missing Image with resourceID: res://screen

I am using the tns preview command and using the NS Playground and NS Preview apps.

When I try to use a different approach, by adding the image to the assets/images/ folder, and refer to it as <Image src="~/images/icon.png"></Image> Then I get:

LOG from device Nexus 6P: Error in reading bitmap - java.io.FileNotFoundException: /data/data/org.nativescript.preview/files/app/images/icon.png (No such file or directory)

Can anyone offer some insight?

Ayudh
  • 1,673
  • 1
  • 22
  • 55
  • Changes to drawable folder requires a rebuild. Preview command do not build the app, it's just a quick way to test simple code. – Manoj May 09 '20 at 13:49

1 Answers1

3

I went with adding the image to the /assets/images folder and referred to it as: <Image src="~/assets/images/icon.png"></Image>

Ayudh
  • 1,673
  • 1
  • 22
  • 55