2015-10-16 135 views
-4

logcat的顯示Apllictication停止工作

10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime: FATAL EXCEPTION: main 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime: Process: com.example.rahul.myapplication, PID: 15064 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.rahul.myapplication/com.example.rahul.myapplication.StudentDetail}; have you declared this activity in your AndroidManifest.xml? 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime:  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1794) 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime:  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1512) 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime:  at android.app.Activity.startActivityForResult(Activity.java:3917) 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime:  at android.app.Activity.startActivityForResult(Activity.java:3877) 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime:  at android.app.Activity.startActivity(Activity.java:4200) 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime:  at android.app.Activity.startActivity(Activity.java:4168) 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime:  at com.example.rahul.myapplication.MainActivity.onClick(MainActivity.java:52) 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime:  at android.view.View.performClick(View.java:5198) 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime:  at android.view.View$PerformClick.run(View.java:21147) 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime:  at android.os.Handler.handleCallback(Handler.java:739) 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:95) 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime:  at android.os.Looper.loop(Looper.java:148) 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime:  at android.app.ActivityThread.main(ActivityThread.java:5417) 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime:  at java.lang.reflect.Method.invoke(Native Method) 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
10-16 13:51:51.310 15064-15064/com.example.rahul.myapplication E/AndroidRuntime:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

我的Android清單文件

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.rahul.myapplication" > 

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name=".MainActivity" 
      android:label="@string/app_name" 
      android:theme="@style/AppTheme.NoActionBar" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 

    </application> 

</manifest> 

請幫我的程序不會工作後,我點擊添加按鈕,並在意向
呼叫學生的詳細信息類... .................................................. .................................................. .................................................. .................................................. .................................................. .... ..................................................下面的代碼清單中

<activity 
     android:name=".StudentDetail" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme.NoActionBar" > 

    </activity> 
+0

ActivityNotFoundException沒有找到excption意味着你沒有申報清單文件中的活動 – Soham

+0

你沒有申報' StudentDetail'在您的清單中的活動。 –

+0

[android.content.ActivityNotFoundException:]可能的重複:(http://stackoverflow.com/questions/3433778/android-content-activitynotfoundexception) – Soham

回答

0

添加到您的清單。序加StudentDetail活動,在您的清單中添加以下代碼:

<activity 
     android:name=".StudentDetail" 
     android:label="yourAppLabel" 
     android:theme="@style/AppTheme.NoActionBar" /> 

請注意,你可以保持你自己的標籤和主題爲您的活動。這裏使用的主題是AppTheme.NoActionBar。

-1

寫您應該添加您的Applicationin的每一個活動清單文件:

0

<activity 
    android:name=".StudentDetail" 
    android:label="@string/student_label" 
    android:theme="@style/AppTheme.NoActionBar" /> 
0

您需要StudentDetail活動添加到您的清單文件 添加

<activity android:name=".StudentDetaill" ></activity>