开发者社区> 问答> 正文

android中出现ActivityNotFoundException异常

自己编的程序出现了异常数值总传不过去是怎么回事?
String num=editText.getText().toString();

            num=num.trim();             
            Intent numIntent=new Intent();              
            numIntent.putExtra("num",num);              
            startActivityForResult(numIntent,NUMVALUE);

这个是按钮的监听事件。
case NUMVALUE:

             String guessNum=intent.getStringExtra("num");
             System.out.println(guessNum);
             int guessNumber=Integer.parseInt(guessNum);

这个事onActivityResult方法接收数据的代码,但是总是传不过去是怎么回事?
异常如下:

 07-30 14:25:39.328: E/AndroidRuntime(678): FATAL EXCEPTION: main
 07-30 14:25:39.328: E/AndroidRuntime(678): android.content.ActivityNotFoundException: No Activity found to handle Intent { (has extras) }
 07-30 14:25:39.328: E/AndroidRuntime(678): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409)
 07-30 14:25:39.328: E/AndroidRuntime(678): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
 07-30 14:25:39.328: E/AndroidRuntime(678): at android.app.Activity.startActivityForResult(Activity.java:2827)
 07-30 14:25:39.328: E/AndroidRuntime(678): at com.example.smallgames.GuessActivity$1.onClick(GuessActivity.java:69)
 07-30 14:25:39.328: E/AndroidRuntime(678): at android.view.View.performClick(View.java:2485)
 07-30 14:25:39.328: E/AndroidRuntime(678): at android.view.View$PerformClick.run(View.java:9080)
 07-30 14:25:39.328: E/AndroidRuntime(678): at android.os.Handler.handleCallback(Handler.java:587)
 07-30 14:25:39.328: E/AndroidRuntime(678): at android.os.Handler.dispatchMessage(Handler.java:92)
 07-30 14:25:39.328: E/AndroidRuntime(678): at android.os.Looper.loop(Looper.java:123)
 07-30 14:25:39.328: E/AndroidRuntime(678): at android.app.ActivityThread.main(ActivityThread.java:3683)
 07-30 14:25:39.328: E/AndroidRuntime(678): at java.lang.reflect.Method.invokeNative(Native Method)
 07-30 14:25:39.328: E/AndroidRuntime(678): at java.lang.reflect.Method.invoke(Method.java:507)
 07-30 14:25:39.328: E/AndroidRuntime(678): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
 07-30 14:25:39.328: E/AndroidRuntime(678): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
 07-30 14:25:39.328: E/AndroidRuntime(678): at dalvik.system.NativeStart.main(Native Method)

展开
收起
爵霸 2016-06-14 11:44:55 2675 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
58同城Android客户端Walle框架演进与实践之路 立即下载
Android组件化实现 立即下载
蚂蚁聚宝Android秒级编译——Freeline 立即下载