开发者

Problems with a widget in Android

开发者 https://www.devze.com 2023-03-10 18:39 出处:网络
At the moment, my android widget runs a PendingIntent when you click it. The problem is that if the activity is already running in the background, the wi开发者_如何转开发dget runs it a second time. Is

At the moment, my android widget runs a PendingIntent when you click it. The problem is that if the activity is already running in the background, the wi开发者_如何转开发dget runs it a second time. Is there any way to make the widget open the currently running version as opposed to a completely new one?


You can mark your Activity as having a launchMode of singleTop or singleTask which should let you use the onNewIntent callback to receive the intent. See http://developer.android.com/guide/topics/manifest/activity-element.html#lmode for more detail.

0

精彩评论

暂无评论...
验证码 换一张
取 消