Java Android:由操作启动的对话框\u请求\u启用销毁以前的活动

Java Android:由操作启动的对话框\u请求\u启用销毁以前的活动,java,android,Java,Android,我想从意向服务中使用以下代码启用蓝牙: Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); getApplicationContext().startActivity(enableBtIntent); 我的应用程序的逻辑是: 活动A启动启动此启用\u请求的活动B 我试图从一个服务启动这个请求,甚至在活动B本身之后,但活动B始终是销毁的,活动a出现在前台 这是舱单 <activity and

我想从意向服务中使用以下代码启用蓝牙:

Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
getApplicationContext().startActivity(enableBtIntent);
我的应用程序的逻辑是:

活动A启动启动此启用\u请求的活动B

我试图从一个服务启动这个请求,甚至在活动B本身之后,但活动B始终是销毁的,活动a出现在前台

这是舱单

<activity android:name=".MainActivity">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".ClassifierActivity"
        android:screenOrientation="portrait"
        />


    <service
        android:name=".audio.SpeechRecognitionService"
        android:exported="false"
        android:description = "@string/speech_recognition_service_description"
        />

    <service
        android:name=".interaction.SmartObjectInteractionService"
        android:exported="false"
        />

我找不到任何解决办法!
附注:活动B有一个摄像头片段。

尝试使用startActivityForResult而不是startActivity

谢谢,但我错过了finish()方法调用。。。但是,从服务中,我无法调用StartActivityForResult方法。在这种情况下,最佳做法是创建服务意图并在活动中使用广播接收器捕获它,以便我可以从那里调用它吗?