--- android/Side9/src/dk/thoerup/side9/Side9WidgetProvider.java 2012/02/15 19:10:24 1688 +++ android/Side9/src/dk/thoerup/side9/Side9WidgetProvider.java 2012/02/15 21:05:56 1689 @@ -28,9 +28,10 @@ public static final String TAG = "Side9Pigen"; //The data needs to be static, since BroadcastReceivers (which WidgetProviders extends) are only valid during onReceive() - private static Side9Data mUsedData; - private static Bitmap mUsedBitmap; + private static Side9Data mUsedData; private static long mTimestamp; + + private static String mImagePath; final static long UDPATESPAN = 4*60*60*1000; @@ -45,7 +46,7 @@ public void resetStatics() { Log.i(TAG, "resetStatics"); mUsedData = null; - mUsedBitmap = null; + mImagePath = null; } @@ -60,8 +61,8 @@ RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.side9widget); - if (mUsedBitmap != null) { - views.setImageViewBitmap(R.id.side9picture, mUsedBitmap); + if (mImagePath != null) { + views.setUri(R.id.side9picture, "setImageURI", Uri.parse("file:/" + mImagePath)); } else { views.setImageViewResource(R.id.side9picture, R.drawable.side9logo); } @@ -99,10 +100,6 @@ Log.i(TAG, "onUpdate:"); - if (mUsedBitmap == null) { //load default view - mUsedBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.side9logo); - } - ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); @@ -131,10 +128,9 @@ Log.i(TAG, "(Re)loading image:" + newData.url); - Bitmap image = getImageData(context, newData); + getImageData(context, newData); mUsedData = newData; // if we made it to here without exceptions, save the new data - mUsedBitmap = image; mTimestamp = System.currentTimeMillis(); } // endif @@ -198,6 +194,8 @@ rescan.putExtra("read-only", false); context.sendBroadcast(rescan); + mImagePath = imageFile.toString(); + } else { Log.i(TAG, "sdcard is not mounted"); }