--- android/Side9/src/dk/thoerup/side9/Side9WidgetProvider.java 2010/06/01 07:46:12 775 +++ android/Side9/src/dk/thoerup/side9/Side9WidgetProvider.java 2010/06/01 09:14:19 778 @@ -14,6 +14,7 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.ConnectivityManager; +import android.net.Uri; import android.os.Environment; import android.util.Log; import android.widget.RemoteViews; @@ -40,6 +41,16 @@ public Side9WidgetProvider() { Log.i(TAG, "WidgetProvider constructor called"); } + + public void resetStatics() { + Log.i(TAG, "resetStatics"); + usedData = null; + usedBitmap = null; + } + + + + private void setImage(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds, Bitmap image) { // Perform this loop procedure for each App Widget that belongs to this provider @@ -57,6 +68,7 @@ //views.setTextViewText(R.id.caption, newData.caption); + Intent viewIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("http://www.ekstrabladet.dk/side9/")); //View single file @@ -72,11 +84,11 @@ //viewIntent.setClassName("com.android.camera", "com.android.camera.GalleryPicker"); - Intent viewIntent = new Intent(); + /*Intent viewIntent = new Intent(); viewIntent.addCategory(Intent.CATEGORY_LAUNCHER); viewIntent.setAction(Intent.ACTION_MAIN); viewIntent.setComponent(new ComponentName("com.android.camera", ".GalleryPicker")); - viewIntent.setFlags(0x10200000); + viewIntent.setFlags(0x10200000);*/ @@ -169,6 +181,8 @@ FileOutputStream fos = new FileOutputStream(file); fos.write(imageData); fos.close(); + } else { + Log.i(TAG, "sdcard is not mounted"); } } @@ -181,9 +195,16 @@ public void onDisabled(Context context) { super.onDisabled(context); Log.i(TAG, "onDisabled"); - - usedData = null; //free memory - usedBitmap = null; + + resetStatics();//free memory } + @Override + public void onEnabled(Context context) { + super.onEnabled(context); + Log.i(TAG, "onEnabled"); + + resetStatics();//free memory + } + }