当我尝试运行我的应用程序时,我在 LogCat 上收到此错误:
08-23 17:32:01.700: E/AndroidRuntime(4518): FATAL EXCEPTION: main
08-23 17:32:01.700: E/AndroidRuntime(4518): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.app.myapp/com.library.core.presentation.SessionActivity}: java.lang.NullPointerException
08-23 17:32:01.700: E/AndroidRuntime(4518): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
08-23 17:32:01.700: E/AndroidRuntime(4518): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
当我触摸与此 Intent 相对应的列表项时,会出现问题:
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id)
{
Intent sessionIntent = new Intent(view.getContext(), SessionActivity.class);
//sessionIntent.putExtras(bundle);
startActivity(sessionIntent);
}
SessionActivity 是一个包含在我必须用于此应用程序的库项目中的类。我的清单文件是这样的:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="10" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.rdp.rdp_prova.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.library.core.presentation.SessionActivity" />
</application>
</manifest>
怎么了?