我的应用程序提供了“分享/告诉朋友”功能.当按下“共享”按钮时,将调用以下方法来打开应用程序列表,这些应用程序可以执行 *** 作(例如Gmail,TwittroID,Facebook …):
public voID share() { Intent shareIntent = new Intent(androID.content.Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(androID.content.Intent.EXTRA_SUBJECT, getText(R.string.menu_share_subject)); shareIntent.putExtra(androID.content.Intent.EXTRA_TEXT, getText(R.string.menu_share_body)); startActivity(Intent.createChooser(shareIntent, getText(R.string.menu_share_intent))); }
共享功能基本上可以正常工作.但是,当共享应用程序(Facebook,Twitter等)尝试返回到我的应用程序时,将强制关闭.
我想我的应用在共享过程中会在后台关闭.至少这就是调试器所说的.
有任何想法吗?
问题似乎是该应用程序在后台关闭.另外,当我从应用程序打开浏览器时,请尝试使用返回键返回到我的应用程序.强制关闭.这是Log Cat的输出
04-13 22:28:42.003: ERROR/AndroIDRuntime(18915): Uncaught handler: thread main exiting due to uncaught exception 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): java.lang.RuntimeException: Unable to start activity ComponentInfo{eu.xxx.xxx/eu.xxx.xxx.xxx}: java.lang.NullPointerException 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2401) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.app.ActivityThread.access00(ActivityThread.java:116) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.os.Handler.dispatchMessage(Handler.java:99) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.os.Looper.loop(Looper.java:123) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.app.ActivityThread.main(ActivityThread.java:4203) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at java.lang.reflect.Method.invokeNative(Native Method) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at java.lang.reflect.Method.invoke(Method.java:521) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:549) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at dalvik.system.NativeStart.main(Native Method) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): Caused by: java.lang.NullPointerException 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at eu.xxx.xxx.xxx.fillData(xxx.java:178) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at eu.xxx.xxx.xxx.access(xxx.java:173) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at eu.xxx.xxx.xxx.onTextChanged(xxx.java:139) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.Widget.TextVIEw.sendOnTextChanged(TextVIEw.java:6096) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.Widget.TextVIEw.setText(TextVIEw.java:2677) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.Widget.TextVIEw.setText(TextVIEw.java:2542) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.Widget.EditText.setText(EditText.java:71) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.Widget.TextVIEw.setText(TextVIEw.java:2517) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.Widget.TextVIEw.onRestoreInstanceState(TextVIEw.java:2417) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.vIEw.VIEw.dispatchRestoreInstanceState(VIEw.java:5689) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.vIEw.VIEwGroup.dispatchRestoreInstanceState(VIEwGroup.java:1125) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.vIEw.VIEwGroup.dispatchRestoreInstanceState(VIEwGroup.java:1125) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.vIEw.VIEwGroup.dispatchRestoreInstanceState(VIEwGroup.java:1125) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.vIEw.VIEw.restoreHIErarchyState(VIEw.java:5668) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at com.androID.internal.policy.impl.PhoneWindow.restoreHIErarchyState(PhoneWindow.java:1506) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.app.Activity.onRestoreInstanceState(Activity.java:833) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.app.ListActivity.onRestoreInstanceState(ListActivity.java:221) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.app.Activity.performRestoreInstanceState(Activity.java:805) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1172) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2378) 04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): ... 11 more
解决方法:
04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): Caused by: java.lang.NullPointerException04-13 22:28:42.253: ERROR/AndroIDRuntime(18915): at xx.xxx.xxx.xxx.fillData(xxx.java:178)
您有一个NullPointerException.修正此问题,幸运的是,您的问题将消失.
总结以上是内存溢出为你收集整理的“分享”意图后,Android应用程序崩溃全部内容,希望文章能够帮你解决“分享”意图后,Android应用程序崩溃所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)