質問

I can bring up an activity by clicking on a view in a widget using PendingIntent
If an activity is not yet started, android will create a new and call onCreate(), i can retrieve getExtra() from the widget

However if the activity is already started and in the top of the stack, the target activity is just brought to the top to display without running any code

I cannot use android:launchMode="SingleTop" to call onNewIntent (Intent intent), but I need "multiple" activity from other part of the app

I just want the click event of the widget view just start a new instance of activity as the behaviour of android:launchMode="standard" so that I can decide what should be done based on getExtra()

any idea ? thank you

役に立ちましたか?

解決

sending broadcast when you widget clicked, will help you to the problem of starting activity. you can use the getBroadcast() method of PendingIntent.

public static PendingIntent getBroadcast (Context context, int requestCode, Intent intent, int flags)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top