0
我在小部件,一個ImageView的當過我點擊了它,我開始使用getService
如下停止服務手工插件
Intent intent = new Intent(context,MyService.class);
PendingIntent pendingServiceIntent = PendingIntent.getService(context,0 ,
intent , 0);
,進而爲MyService類發送消息的MyService
onCreate
到處理器服務與消息
myHandler.sendEmptyMessage(MSG_FETCH_DATA);
現在我想停止使用ImageView的是服務,所以我怎麼能做到這一點啓動該服務?我的應用程序要求通過小部件手動停止該服務,以便我不使用stopSelf()
追捕,當你想停止這個服務上的ImageView點擊意味着,如果是,那麼請參閱[控件被點擊(http://stackoverflow.com/questions/9671596/how-do-i-start-an-activity-當 - 我的小部件 - 是 - 點擊/ 9671968#9671968)? – 2012-03-17 07:48:04
Intent intent = new Intent(context,MyService.class);這是我在onReceive中如何在單擊ImageView時這樣做的嗎? – Hunt 2012-03-17 09:54:04