Add compulsory prefix "tmp_" to temporary filename

Fixes Issue #86.

The call to `File.createTempFile` causes an `IllegalArgumentException` as it is expecting the filename parameter to be > 3 characters. Therefore a fatal error occurs when filename prefixes are less than 3 characters e.g.: 3.jpg, ab.jpg etc.

To fix this I have added a compulsory prefix to the created temporary file.
This commit is contained in:
Daniel Smith
2015-10-14 13:03:24 +13:00
parent 81876300a3
commit e188210a33
@@ -617,7 +617,7 @@ public class MultiImageChooserActivity extends Activity implements OnItemClickLi
int index = fileName.lastIndexOf('.');
String name = fileName.substring(0, index);
String ext = fileName.substring(index);
File file = File.createTempFile(name, ext);
File file = File.createTempFile("tmp_" + name, ext);
OutputStream outStream = new FileOutputStream(file);
if (ext.compareToIgnoreCase(".png") == 0) {
bmp.compress(Bitmap.CompressFormat.PNG, quality, outStream);