質問編集履歴
2
widget_info\.xmlを追記しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -85,6 +85,21 @@
|
|
85
85
|
}
|
86
86
|
```
|
87
87
|
|
88
|
+
widget_info.xml
|
89
|
+
```ここに言語を入力
|
90
|
+
<?xml version="1.0" encoding="utf-8"?>
|
91
|
+
<appwidget-provider
|
92
|
+
xmlns:android="http://schemas.android.com/apk/res/android"
|
93
|
+
android:initialKeyguardLayout="@layout/bustimetable_widget"
|
94
|
+
android:initialLayout="@layout/bustimetable_widget"
|
95
|
+
android:minHeight="40dp"
|
96
|
+
android:minWidth="40dp"
|
97
|
+
android:previewImage="@drawable/bus_image"
|
98
|
+
android:resizeMode="horizontal|vertical"
|
99
|
+
android:updatePeriodMillis="0"
|
100
|
+
android:widgetCategory="home_screen"/>
|
101
|
+
```
|
102
|
+
|
88
103
|
Manifest
|
89
104
|
```ここに言語を入力
|
90
105
|
<intent-filter>
|
1
ImageViewのクリックイベントを追加している部分を追記しました。クリックイベントは即時呼び出されていることを確認しております。
title
CHANGED
File without changes
|
body
CHANGED
@@ -12,6 +12,22 @@
|
|
12
12
|
private final int INTERVAL_UPDATE_TIMETABLE = 1000 * 60 * 10;
|
13
13
|
|
14
14
|
@Override
|
15
|
+
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
|
16
|
+
|
17
|
+
DOES_RUN_COUNTDOWN = false;
|
18
|
+
|
19
|
+
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.bustimetable_widget);
|
20
|
+
ComponentName watchWidget = new ComponentName(context, BusTimetableWidget.class);
|
21
|
+
|
22
|
+
remoteViews.setOnClickPendingIntent(
|
23
|
+
R.id.imageView_bus,
|
24
|
+
getPendingIntentBroadcast(context, IMAGE_CLICKED)
|
25
|
+
);
|
26
|
+
|
27
|
+
appWidgetManager.updateAppWidget(watchWidget, remoteViews);
|
28
|
+
}
|
29
|
+
|
30
|
+
@Override
|
15
31
|
public void onReceive(Context context, Intent intent) {
|
16
32
|
// TODO Auto-generated method stub
|
17
33
|
|