Problem with saving picture to sdcard (empty picture).

edited January 2016 in Android Mode

Hello, I am trying to save a picture (save() or saveFrame() to Sdcard. The file is empty. Everything works fine in Java mode.

I have enabled the permission - WRITE_EXTERNAL_STORAGE I can save .txt file but problem is with pictures. The file has 0kB size.

Here's my simply code.

import controlP5.*;

ControlP5 cp5;
PImage backgroundImg = null;

void setup() 
{
  size(displayWidth, displayHeight);
  backgroundImg = loadImage("backImg.jpg");
  backgroundImg.resize(width, height);
  backgroundImg.loadPixels();

  cp5 = new ControlP5(this);
  cp5.addButton("savePicBut")
  .setBroadcast(false)
  .setPosition(30, 30)
  .setSize(30,30)
  .setLabel("Save")
  .setBroadcast(true);
}

void draw() 
{ 
    background(backgroundImg);
}

public void savePicBut()
{
  saveFrame("//sdcard/PicTest.png");

  String[] words = {"test1","test2","test3"};
  saveStrings("//sdcard/words.txt",words);  
}

Thanks a lot for your help. Sebastian

Answers

Sign In or Register to comment.