gpt4 book ai didi

android - 应用程序退出而不是进入下一个 Activity

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:10:32 26 4
gpt4 key购买 nike

我通过一个简单的 Intent 调用一个 Activity :

Intent startNewActivityOpen2 = new Intent(this, TransitionLandscape.class);
if (extras != null) {
if (!extras.isEmpty()) {

startNewActivityOpen2.putExtras(extras);
}
}

startActivity(startNewActivityOpen2);

当前 Activity 也是 TransistionLandscape.class 重要吗?当我开始新 Activity 时,应用程序退出(没有崩溃)。通过调试器,永远不会调用新 Activity :(永远不会调用 onCreate in)

从文档来看,好像一个activity是可以调用自己的。

逻辑猫:

12-10 21:08:23.410 543-553/? I/ActivityManager: START u0
{cmp=com.assistek.ediary/.TransitionLandscape (has extras)} from pid
4801
12-10 21:08:23.470 543-573/? D/dalvikvm: GC_FOR_ALLOC freed 437K, 18% free 14435K/17524K, paused 51ms, total 52ms
12-10 21:08:23.490 4801-4801/com.assistek.ediary D/Base Activity: **********Pause class com.assistek.ediary.TransitionLandscape
**********Pause Navigate: true
**********Resume class com.assistek.ediary.TransitionLandscape
**********Focus: false Activity: class com.assistek.ediary.TransitionLandscape
12-10 21:08:23.500 4801-4801/com.assistek.ediary D/Base Activity: **********Pause class com.assistek.ediary.TransitionLandscape
**********Pause Navigate: false
12-10 21:08:23.520 543-600/? I/InputReader: Reconfiguring input devices. changes=0x00000004
Device reconfigured: id=2, name='elan-touchscreen', size 800x1280, orientation 0, mode 1, display id 0
12-10 21:08:23.520 543-1012/? I/ActivityManager: Config changes=480 {1.0 310mcc170mnc en_US ldltr sw600dp w600dp h880dp 213dpi
lrg port finger -keyb/v/h -nav/h s.11}
12-10 21:08:23.540 961-961/? I/PCKeyboard: onConfigurationChanged()
12-10 21:08:23.580 543-561/? I/WindowManager: Screen frozen for +74ms due to Window{425793b8 u0 com.assistek.ediary/com.assistek.ediary.TransitionLandscape}
12-10 21:08:23.600 634-634/? D/PhoneStatusBar: mSettingsPanelGravity = 8388661
12-10 21:08:23.690 543-1045/? I/ActivityManager: Killing 1995:com.google.android.setupwizard/u0a50 (adj 15): empty #17
12-10 21:08:23.720 4801-4801/com.assistek.ediary W/IInputConnectionWrapper: showStatusIcon on inactive InputConnection
12-10 21:08:23.730 4801-4801/com.assistek.ediary D/Base Activity: **********Stop Navigate Away false
**********Stop class com.assistek.ediary.TransitionLandscape
**********Stop Focus ToClass class com.assistek.ediary.TransitionLandscape
Task ID 151
**********Destroy class com.assistek.ediary.TransitionLandscape
12-10 21:08:23.740 4801-4801/com.assistek.ediary D/Time calculation:: Destroy: class
com.assistek.ediary.TransitionLandscape
12-10 21:08:25.660 543-561/? D/dalvikvm: GC_EXPLICIT freed 287K, 18% free 14449K/17524K, paused 8ms+5ms, total 78ms
12-10 21:08:26.430 543-600/? I/InputReader: Reconfiguring input devices. changes=0x00000004
Device reconfigured: id=2, name='elan-touchscreen', size 800x1280, orientation 1, mode 1, display id 0
12-10 21:08:26.430 543-566/? I/ActivityManager: Config changes=480 {1.0 310mcc170mnc en_US ldltr sw600dp w961dp h528dp 213dpi lrg land
finger -keyb/v/h -nav/h s.12}
12-10 21:08:26.460 961-961/? I/PCKeyboard: onConfigurationChanged()

此外,调用:

recreate() 

不是去新的 Activity,而是导致应用程序退出(没有崩溃)。

编辑: list

        <activity
android:name=".TransitionLandscape"
android:configChanges="orientation"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="landscape"
android:windowSoftInputMode="stateHidden">
</activity>

实际上,我在 TransitionLandscape 之后调用的任何 Activity 都会导致应用退出。是内存问题吗?

最佳答案

您的应用在该 Intent 之后崩溃,因为收到配置更改。

12-10 21:08:23.520 543-600/? I/InputReader: Reconfiguring input devices.  changes=0x00000004
Device reconfigured: id=2, name='elan-touchscreen', size 800x1280, orientation 0, mode 1, display id 0
12-10 21:08:23.520 543-1012/? I/ActivityManager: Config changes=480 {1.0 310mcc170mnc en_US ldltr sw600dp w600dp h880dp 213dpi
lrg port finger -keyb/v/h -nav/h s.11}
12-10 21:08:23.540 961-961/? I/PCKeyboard: onConfigurationChanged()
12-10 21:08:23.740 4801-4801/com.assistek.ediary D/Time calculation:: Destroy: class
com.assistek.ediary.TransitionLandscape

你能试试吗

android:configChanges="orientation|screenSize|keyboardHidden" />

还有其他方法可以处理配置更改你可以查看这个link

关于android - 应用程序退出而不是进入下一个 Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53975256/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com