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.
精彩评论