i have a digital widget clock that works nicely!!
but the problem here is that it doesn't update i mean it just shows the time of that moment that i add that to home screen!!!
in widget.java:
I have an onUpdate like this:
Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
super.onUpdate(context, appWidgetManager, appWidgetIds);
for (int i = 0; i < appWidgetIds.length; i++) {
int appWidgetId = appWidgetIds[i];
and then inside of onUpdate first i have used the Time method to get the Hour and minute as string :
Time today = new Time(Time.getCurrentTimezone());
today.setToNow();
int hour = today.hour;
String hh = Integer.toString(hour);
int minute = today.minute;
String mm = ":" + Integer.toString(minute);
and then i have showed those two strings inside of two image views with bitmap:
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
views.setImageViewBitmap(R.id.imageView1, getFontBitmap(context, hh, Color.WHITE, 70));
views.setImageViewBitmap(R.id.imageView2, getFontBitmap1(context, mm, Color.WHITE, 70));
appWidgetManager.updateAppWidget(appWidgetId, views);
}
}
and this my receiver in manifest:
<receiver android:name="widget">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/widget"/>
and here is my widget.xml in res/xml:
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="288dp"
android:minHeight="144dp"
android:updatePeriodMillis="10000"
android:initialLayout="@layout/widget_layout">
</appwidget-provider>
so any help?
Thanks in advance