데이터는 원하는 곳에 저장을 한뒤 아래와 같이 위젯이 내용을 갱신할 수 있도록 이벤트를 전달 합니다.
sendBroadcast(getApplicationContext(), YourWidget.class, YourWidget.EVENT_NAME, null);
public void sendBroadcast(Context context, Class<?> target, String action, String data) {
if (context == null) {
DLog.e(TAG, "sendBroadcast <context == null>");
return ;
}
Intent intent = new Intent(context, target);
intent.setAction(action);
if (data != null) {
intent.putExtra(action, data);
}
context.sendBroadcast(intent);
}