以下是我的 Activity 在 AndroidManifest.xml 文件中的定义方式:-
<activity android:name=".MyDialog"
android:launchMode="singleTask"
android:theme="@android:style/Theme.Dialog"/>
我的服务是如何定义的:-
<service
android:name=".ChatHeadService"
android:process=":chatHead"/>
我如何从服务中调用它:-
Intent intent = new Intent(this, MyDialog.class);
intent.setAction(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
Activity 仍然没有开始!请帮忙。谢谢:)
最佳答案
来自Service类内部
Intent intent = new Intent(this, MyDialog.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent );
关于java - 新 Intent 未从服务开始(尝试了 Google 的所有解决方案),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30928940/