Android Writing/Reading Picture To Internal Storage
Question
I faced a problem saving and loading Pictures on android (Picture object). Here is my code for writing to Internal Storage (i am not sure if it works properly):
FileOutputStream fos = null;
Picture l0 = new Picture();
fos = openFileOutput("layer0", Context.MODE_PRIVATE);
InputStream is = new ByteArrayInputStream(layer0.getBytes());
SVG svg = SVGParser.getSVGFromInputStream(is);
l0 = svg.getPicture();
l0.writeToStream(fos);
fos.close();
How can I read this image back? And please check this way of storing it. Cheers.
Solution
Use the function createFromStream
Something like:
Picture myPic = Picture.createFromStream(openFileInput("layer0"));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow