繁体   English   中英

新的意图不是从服务开始的(尝试了Google的所有解决方案)

[英]new Intent not starting from Service ( Tried all solutions from Google)

这是在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);

活动仍然没有开始! 请帮忙。 谢谢 :)

从服务类内部

Intent intent = new Intent(this, MyDialog.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent );

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM