
我通过一个简单的意图调用一个活动:
Intent startNewActivityOpen2 = new Intent(this, TransitionLandscape.class);if (extras != null) { if (!extras.isEmpty()) { startNewActivityOpen2.putExtras(extras); }}startActivity(startNewActivityOpen2);这个当前活动是否也是TransistionLandscape.class是否重要?当我开始新活动时,应用程序会退出(不会崩溃).通过调试器,永远不会调用新活动:(永远不会调用onCreate in)
从文档中可以看出,一个活动可以调用自己.
logcat的:
12-10 21:08:23.410 543-553/? I/ActivityManager: START u0{cmp=com.assistek.ediary/.TransitionLandscape (has extras)} from pID480112-10 21:08:23.470 543-573/? D/dalvikvm: GC_FOR_ALLOC freed 437K, 18% free 14435K/17524K, paused 51ms, total 52ms12-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.TransitionLandscape12-10 21:08:23.500 4801-4801/com.assistek.ediary D/Base Activity: **********Pause class com.assistek.ediary.TransitionLandscape **********Pause Navigate: false12-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 012-10 21:08:23.520 543-1012/? I/ActivityManager: Config changes=480 {1.0 310mcc170mnc en_US ldltr sw600dp w600dp h880dp 213dpilrg 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 = 838866112-10 21:08:23.690 543-1045/? I/ActivityManager: Killing 1995:com.Google.androID.setupwizard/u0a50 (adj 15): empty #1712-10 21:08:23.720 4801-4801/com.assistek.ediary W/IinputConnectionWrapper: showStatusIcon on inactive inputConnection12-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.TransitionLandscape12-10 21:08:23.740 4801-4801/com.assistek.ediary D/Time calculation:: Destroy: classcom.assistek.ediary.TransitionLandscape12-10 21:08:25.660 543-561/? D/dalvikvm: GC_EXPliCIT freed 287K, 18% free 14449K/17524K, paused 8ms+5ms, total 78ms12-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 012-10 21:08:26.430 543-566/? I/ActivityManager: Config changes=480 {1.0 310mcc170mnc en_US ldltr sw600dp w961dp h528dp 213dpi lrg landfinger -keyb/v/h -nav/h s.12}12-10 21:08:26.460 961-961/? I/PCKeyboard: onConfigurationChanged()另外,致电:
recreate() 而不是去新的活动,也导致应用程序退出(没有崩溃).
编辑:清单
<activity androID:name=".TransitionLandscape" androID:configChanges="orIEntation" androID:label="@string/app_name" androID:launchMode="singleTask" androID:screenorIEntation="landscape" androID:windowsoftinputMode="stateHIDden"> </activity>实际上,我在TransitionLandscape之后调用的任何活动都会导致应用程序退出.这是记忆问题吗?
解决方法:
在收到配置更改后,您的应用程序在该意图后崩溃.
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 012-10 21:08:23.520 543-1012/? I/ActivityManager: Config changes=480 {1.0 310mcc170mnc en_US ldltr sw600dp w600dp h880dp 213dpilrg 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: classcom.assistek.ediary.TransitionLandscape你能试试吗?
androID:configChanges="orIEntation|screenSize|keyboardHIDden" />还有其他方法可以处理配置更改
你可以查看这个link
以上是内存溢出为你收集整理的android – 应用程序退出而不是进入下一个活动全部内容,希望文章能够帮你解决android – 应用程序退出而不是进入下一个活动所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)