Apllictication停止工作

时间:2015-10-16 12:38:45

标签: android android-studio

Logcat显示

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>

请点击添加按钮并在意图中帮助我该程序无法正常工作 致电学生详情课.............................................. .................................................. .................................................. .................................................. .................................................. .................................................. ...........

4 个答案:

答案 0 :(得分:0)

将此添加到您的清单:

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

答案 1 :(得分:0)

您应该在清单文件中添加应用程序的每个活动。要添加StudentDetail Activity,请在清单中添加以下代码:

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

请注意,您可以为自己的活动保留自己的标签和主题。这里使用的主题是AppTheme.NoActionBar。

答案 2 :(得分:0)

您需要将StudentDetail活动添加到清单文件中 添加

free

答案 3 :(得分:-1)

在清单

中写下以下代码
 <activity
        android:name=".StudentDetail"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar" >

    </activity>