Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/389.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法从android oreo中的服务启动触觉_Java_Android - Fatal编程技术网

Java 无法从android oreo中的服务启动触觉

Java 无法从android oreo中的服务启动触觉,java,android,Java,Android,我的应用程序因从服务启动活动而崩溃。 在我使用下面的代码启动活动的Android Api 26(oreo)版本中,是否有任何方法可以从服务启动活动* Intent stopDialog=new Intent(this, DialogActivity.class); stopDialog.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); stopDialog.addFlags(Intent.FLAG_ACTIVITY_

我的应用程序因从服务启动活动而崩溃。

在我使用下面的代码启动活动的Android Api 26(oreo)版本中,是否有任何方法可以从服务启动活动*

Intent stopDialog=new Intent(this, DialogActivity.class);
        stopDialog.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        stopDialog.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(stopDialog);

确保在
AndroidMenifest.xml
文件中提到您的
活动。
如果提到这一点,请尝试以下方法:

Intent stopDialog = new Intent();
stopDialog.setClass(this, DialogActivity.class);
stopDialog.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(stopDialog);

最后我自己解决了我的问题,我在活动中使用了方向,这是从服务开始的,logcat说我只能在全屏活动中使用方向

这是我已从活动中删除方向标签的解决方案

 <activity
            android:name=".DialogActivity"
            android:excludeFromRecents="true"
            android:launchMode="singleTop"
            android:theme="@style/MyDialogTheme">
        </activity>


仍在崩溃,你可以从Logcat共享日志吗?。