--- android/Side9/src/dk/thoerup/side9/Side9WidgetProvider.java 2010/06/02 16:13:01 787 +++ android/Side9/src/dk/thoerup/side9/Side9WidgetProvider.java 2010/06/03 06:55:59 788 @@ -28,10 +28,7 @@ private static Bitmap usedBitmap; private static long timestamp; - final static long UDPATESPAN = 3*60*60*1000; - - final static String SAVEDIR = "/sdcard/Side9/"; - + final static long UDPATESPAN = 4*60*60*1000; static { timestamp = 0L; @@ -156,7 +153,9 @@ SharedPreferences prefs = context.getSharedPreferences(TAG, Context.MODE_PRIVATE); boolean saveImage = prefs.getBoolean("saveimage", false); - File file = new File( SAVEDIR + data.getFilename() ); + final String savepath = Environment.getExternalStorageDirectory() + "/Side9"; + + File file = new File( savepath + "/" + data.getFilename() ); /* if the picture changes later on the day we do NOT want to use an old and invalid image if (saveImage == true) { @@ -170,7 +169,7 @@ if (saveImage == true) { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { - File savedir = new File(SAVEDIR); + File savedir = new File(savepath); savedir.mkdirs(); if (file.exists()) { @@ -180,6 +179,11 @@ FileOutputStream fos = new FileOutputStream(file); fos.write(imageData); fos.close(); + + Intent rescan = new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()) ); + rescan.putExtra("read-only", false); + context.sendBroadcast(rescan); + } else { Log.i(TAG, "sdcard is not mounted"); }