startService()是否创建一个新的Service实例或使用现有的实例? 例如,在下面的代码中,它是创建两个UpdateService实例还是只创建一个UpdateService实例? 谢谢。startService()是否创建一个新的Service实例或使用现有的实例?
int[] appWidgetIds = new int[] {1, 2};
for (int appWidgetId : appWidgetIds) {
Intent intent = new Intent(context, UpdateService.class);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
context.startService(intent);
}
谢谢@CommonsWare我upvoted你的问题,每次我看到你的答案,它最容易理解,我发现有帮助和upvote你的答案:) – blackHawk 2017-08-25 09:02:32