Android的 - 活动未发现异常 [英] Android - Activity Not Found Exception

查看:97
本文介绍了Android的 - 活动未发现异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用startActivity调用另一个活动,我也得到了活动未发现异常。这是我的code:

I am using startActivity to call another Activity and I get the "Activity Not Found Exception". Here is my code:

  TextView textView = (TextView) itemClicked;
  String strText = textView.getText().toString();
  String key = "symptom";
  Intent mIntent = new Intent(symptomActivity.this, symptomRemedyActivity.class);
  Bundle mBundle = new Bundle();
  mBundle.putString(key, strText);
  mIntent.putExtras(mBundle);
  startActivity(mIntent);

下面是logcat的输出:

Here is the Logcat output:

INFO/ActivityManager(59): Displayed activity com.android.homeopathy/.HomeopathyActivity: 5542 ms (total 39089 ms)
INFO/ARMAssembler(59): generated scanline__00000077:03545404_00000004_00000000 [ 47 ipp] (67 ins) at [0x3283e0:0x3284ec] in 627000 ns
INFO/ActivityManager(59): Starting activity: Intent { cmp=com.android.homeopathy/.symptomActivity }
INFO/ActivityManager(59): Displayed activity com.android.homeopathy/.symptomActivity: 2706 ms (total 2706 ms)
INFO/ActivityManager(59): Starting activity: Intent { cmp=com.android.homeopathy/.symptomRemedyActivity (has extras) }

下面是调试窗口输出:

    Thread [<1> main] (Suspended (exception ActivityNotFoundException)) 
Instrumentation.checkStartActivityResult(int, Object) line: 1404    
Instrumentation.execStartActivity(Context, IBinder, IBinder, Activity, Intent, int) line: 1378  
symptomActivity(Activity).startActivityForResult(Intent, int) line: 2817    
symptomActivity(Activity).startActivity(Intent) line: 2923  
symptomActivity$1.onItemClick(AdapterView, View, int, long) line: 67    
ListView(AdapterView).performItemClick(View, int, long) line: 284   
ListView.performItemClick(View, int, long) line: 3382   
AbsListView$PerformClick.run() line: 1696   
ViewRoot(Handler).handleCallback(Message) line: 587 
ViewRoot(Handler).dispatchMessage(Message) line: 92 
Looper.loop() line: 123 
ActivityThread.main(String[]) line: 4627    
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
Method.invoke(Object, Object...) line: 521  
ZygoteInit$MethodAndArgsCaller.run() line: 868  
ZygoteInit.main(String[]) line: 626 
NativeStart.main(String[]) line: not available [native method]  

symptomRemedyActivity是在我的项目的另一个活动。有什么我需要做的像进口symptomRemedyActivity让startActivity可以看到symptomRemedyActivity,删除此活动未发现异常?

symptomRemedyActivity is another activity in my project. Is there something I need to do like importing symptomRemedyActivity so that startActivity can see symptomRemedyActivity, to remove this "Activity Not Found Exception"?

推荐答案

我知道这是旧的文章,但它是在谷歌搜索的那一刻的顶部,这样的人谁也来到这里以后: ActivityNotFound 可以通过未处理的异常在你的的onCreate 在你想创建活动引起的。我花了一段时间才能发现,我招惹了 NullPointerException异常那里,因为我不是在寻找它。

I know this is an old post, but it's on top of the google search at the moment, so for anyone who would come here later: ActivityNotFound can be caused by unhandled exceptions in your onCreate in the activity you're trying to create. It took me a while to notice that I was causing a nullPointerException there, because I wasn't looking for it.

这篇关于Android的 - 活动未发现异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆