Quantcast
Channel: Android Mode - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 941

Problem with saving picture to sdcard (empty picture).

$
0
0

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


Viewing all articles
Browse latest Browse all 941

Latest Images

Trending Articles



Latest Images