Android simple widget
<p>I have a problem with my first android widget... I am doing like this:</p>

<pre><code>public class TestwidActivity extends AppWidgetProvider {

    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager,int[] appWidgetIds) {

        Timer timer = new Timer();
        timer.scheduleAtFixedRate(new MyTime(context, appWidgetManager), 1, 1000);
    }

    @Override
    public void onReceive(Context context, Intent intent) {
    // v1.5 fix that doesn't call onDelete Action
        final String action = intent.getAction();
        if (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)) {
            final int appWidgetId = intent.getExtras().getInt(
                AppWidgetManager.EXTRA_APPWIDGET_ID,
                AppWidgetManager.INVALID_APPWIDGET_ID);
            if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
                this.onDeleted(context, new int[] { appWidgetId });
            }
        } else {
            super.onReceive(context, intent);
        }
    }

    private class MyTime extends TimerTask {
        RemoteViews remoteViews;
        AppWidgetManager appWidgetManager;
        ComponentName thisWidget;
        java.text.DateFormat format = SimpleDateFormat.getTimeInstance(SimpleDateFormat.MEDIUM,Locale.getDefault());

        public MyTime(Context context, AppWidgetManager appWidgetManager) {
            this.appWidgetManager = appWidgetManager;
            remoteViews = new RemoteViews(context.getPackageName(), R.layout.main);
            thisWidget = new ComponentName(context, TestwidActivity.class);
        }

        @Override
        public void run() {
            Bitmap bm;
            remoteViews.setTextViewText(R.id.Clock,
                "Time = " + format.format(new Date()));
            bm= BitmapFactory.decodeFile("/sdcard/myFile.png");
            remoteViews.setImageViewBitmap(R.id.team11, bm);
            appWidgetManager.updateAppWidget(thisWidget, remoteViews);
        }
    }
}
</code></pre>

<p>but this stops printing the time after 2 seconds. If I only print the time without the image it works perfect, but in this way it doesn't.why?</p>
