# Adding images to android sketch

**URL:** <https://discourse.processing.org/t/adding-images-to-android-sketch/13144>\
**Category:** Processing for Android\
**Created:** [August 2, 2019, 6:10pm UTC](https://discourse.processing.org/t/adding-images-to-android-sketch/13144 "2019-08-02T18:10:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Asra](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@Asra](https://discourse.processing.org/u/Asra)\
**Post date:** [August 2, 2019, 6:10pm UTC](https://discourse.processing.org/t/adding-images-to-android-sketch/13144/1 "2019-08-02T18:10:05Z")

</div>

Recently I have started to work on a processing game that I want to try on android, the only problem is that I started in java mode and switched to android later, so now whenever I call an image it would give me an error. I added dataPath("") but that only gave me another error, I am not very well familiarized with the android mode so any help would be greatly appreciated! Here is my code for declaring images below.

```auto
void setup(){
  size(1080,1080);
  background(r1,g1,b1);
  heart1 = loadImage(dataPath("")+"heart-UP.png");
  
  heart2 = loadImage(dataPath("")+"heart-UP.png");
  heart3 = loadImage(dataPath("")+"heart-UP.png");
  restart = loadImage("Restart-UP(1).png");
  
  mute = loadImage(dataPath("")+"mute-OFF.png");
  music = new SoundFile(this, "4RunSong.wav");
  
  restart.resize(540,270);
  
  music.loop();
}

```

Also, the error I kept on getting after I added dataPath("") was:  
java.lang.IllegalArgumentException: File /data/user/0/processing.test.ranjan\_4run/filesheart-UP.png contains a path separator

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [August 3, 2019, 12:56am UTC](https://discourse.processing.org/t/adding-images-to-android-sketch/13144/2 "2019-08-03T00:56:53Z")

</div>

first question would be, where are your files?  
in the

> /sketch/

dir or in the

> /sketch/data/

dir what would be good style ( for java and export … possibly for andriod mode also )

---

<div class="post-metadata">

**Author:** ![Syed\_Daanish](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@Syed\_Daanish](https://discourse.processing.org/u/Syed_Daanish)\
**Post date:** [June 26, 2021, 5:30pm UTC](https://discourse.processing.org/t/adding-images-to-android-sketch/13144/3 "2021-06-26T17:30:29Z")

</div>

I think you should add the `"heart-UP.png"` in the `dataPath("")` function.(as your error says:- `/data/user/0/processing.test.ranjan_4run/file **sh** eart-UP.png` the `sh` are not seperated by `"/"`

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [June 30, 2021, 4:01pm UTC](https://discourse.processing.org/t/adding-images-to-android-sketch/13144/4 "2021-06-30T16:01:23Z")

</div>

@Asra === this error is a very common one: look inside the forum and you can find the way to solve it…

---

<div class="post-metadata">

**Author:** ![Asra](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@Asra](https://discourse.processing.org/u/Asra)\
**Post date:** [June 30, 2021, 4:18pm UTC](https://discourse.processing.org/t/adding-images-to-android-sketch/13144/5 "2021-06-30T16:18:21Z")

</div>

Just a note I found a solution but it was around 2 years ago so I have forgotten it, thank you for trying to help me but I have already finished the project that this was for

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [June 30, 2021, 7:36pm UTC](https://discourse.processing.org/t/adding-images-to-android-sketch/13144/6 "2021-06-30T19:36:20Z")

</div>

please use the forum search function, this question has been explained in detail.
