157 |
|
|
158 |
final String savepath = Environment.getExternalStorageDirectory() + "/Side9"; |
final String savepath = Environment.getExternalStorageDirectory() + "/Side9"; |
159 |
|
|
160 |
File file = new File( savepath + "/" + data.getFilename() ); |
File imageFile = new File( savepath + "/" + data.getFilename() ); |
161 |
|
|
162 |
/* if the picture changes later on the day we do NOT want to use an old and invalid image |
/* if the picture changes later on the day we do NOT want to use an old and invalid image |
163 |
if (saveImage == true) { |
if (saveImage == true) { |
174 |
File savedir = new File(savepath); |
File savedir = new File(savepath); |
175 |
savedir.mkdirs(); |
savedir.mkdirs(); |
176 |
|
|
177 |
if (file.exists()) { |
if (imageFile.exists()) { |
178 |
file.delete(); |
imageFile.delete(); |
179 |
} |
} |
180 |
|
|
181 |
FileOutputStream fos = new FileOutputStream(file); |
FileOutputStream fos = new FileOutputStream(imageFile); |
182 |
fos.write(imageData); |
fos.write(imageData); |
183 |
fos.close(); |
fos.close(); |
184 |
|
|
185 |
File infoFile = new File( file.toString().replace(".jpg", ".txt")); |
File infoFile = new File( imageFile.toString().replace(".jpg", ".txt")); |
186 |
if (infoFile.exists()) { |
if (infoFile.exists()) { |
187 |
infoFile.delete(); |
infoFile.delete(); |
188 |
} |
} |
189 |
fos = new FileOutputStream(infoFile); |
fos = new FileOutputStream(infoFile); |
190 |
fos.write(data.caption.getBytes()); |
fos.write(data.caption.getBytes()); |
191 |
fos.close(); |
fos.close(); |
192 |
|
|
193 |
|
//save a thumb image |
194 |
|
ImageAdapter.generateAndLoadThumb(imageFile); |
195 |
|
|
196 |
Intent rescan = new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()) ); |
Intent rescan = new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()) ); |
197 |
rescan.putExtra("read-only", false); |
rescan.putExtra("read-only", false); |