第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

最近屏幕后如何返回上一個活動

最近屏幕后如何返回上一個活動

www說 2021-06-29 17:58:20
我有一個包含主要活動和彈出活動的應(yīng)用程序,如果我留在應(yīng)用程序中就沒有問題。但是,如果彈出活動已打開并且您從最近的屏幕重新進入應(yīng)用程序,則只會顯示彈出活動。如果您然后關(guān)閉它,您不會返回到主要活動,但應(yīng)用程序會完全關(guān)閉。這將打開主活動的彈出活動:intent = new Intent(ctx, popupActivity.class);intent.putExtra("rackName", resultChest.get(2));ctx.startActivity(intent);這是關(guān)閉彈出活動的方法:@Overridepublic boolean onTouchEvent(MotionEvent event) {    finish();    return super.onTouchEvent(event);}AndroidManifest.xml:<application    android:allowBackup="true"    android:icon="@mipmap/ic_lchr"    android:logo="@mipmap/ic_lchr"    android:label="@string/app_name"    android:roundIcon="@mipmap/ic_lchr_round"    android:supportsRtl="true">    <activity android:name=".MainActivity"        android:theme="@style/AppTheme">        <intent-filter>            <action android:name="android.intent.action.MAIN" />            <category android:name="android.intent.category.LAUNCHER"/>        </intent-filter>    </activity>    <activity android:name=".popupActivity"        android:theme="@style/popupTheme"        android:launchMode = "singleInstance">    </activity></application>解決方案:正如@RedWolf 提到的,android:launchMode = "singleInstance"導(dǎo)致活動在另一個任務(wù)中打開,這導(dǎo)致了我的問題。為了解決這個問題并防止彈出活動打開兩次,我不得不將其android:launchMode = "singleTop"用于彈出活動。
查看完整描述

2 回答

?
拉風(fēng)的咖菲貓

TA貢獻1995條經(jīng)驗 獲得超2個贊

不要使用android:launchMode = "singleInstance",它會創(chuàng)建一個新任務(wù)。


查看完整回答
反對 回復(fù) 2021-07-14
  • 2 回答
  • 0 關(guān)注
  • 149 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號