I'm quite new to android programming and I have the following problem. I want to be able to put an image om my server and then if I use my app it should use that image as a background. From previous research I understand I cant save any files to the drawable file? So is this even possible?
I am now this far:
URL url = new URL ("http://oranjelan.nl/oranjelan-bg.png");
InputStream input = url.openStream();
try {
String storagePath = Environment.getExternalStorageDirectory();
OutputStream output = new FileOutputStream (storagePath + "/oranjelangb.png");
try {
byte[] buffer = new byte[1000000];
int bytesRead = 0;
while ((bytesRead = input.read(buffer, 0, buffer.length)) >= 0) {
output.write(buffer, 0, bytesRead);
}
} finally {
output.close();
}
} finally {
input.close();
}
But I get the following error @ String storagePath = Environment.getExternalStorageDirectory(); The compiller says cannot convert file to string.