02-27 22:53:13.047: E/AndroidRuntime(11744): FATAL EXCEPTION: main
02-27 22:53:13.047: E/AndroidRuntime(11744): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.itcuties.android.reader/com.itcuties.android.reader.ItemDescriptionActivity}: java.lang.NullPointerException
02-27 22:53:13.047: E/AndroidRuntime(11744): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
02-27 22:53:13.047: E/AndroidRuntime(11744): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
02-27 22:53:13.047: E/AndroidRuntime(11744): at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-27 22:53:13.047: E/AndroidRuntime(11744): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
02-27 22:53:13.047: E/AndroidRuntime(11744): at android.os.Handler.dispatchMessage(Handler.java:99)
02-27 22:53:13.047: E/AndroidRuntime(11744): at android.os.Looper.loop(Looper.java:137)
02-27 22:53:13.047: E/AndroidRuntime(11744): at android.app.ActivityThread.main(ActivityThread.java:5041)
02-27 22:53:13.047: E/AndroidRuntime(11744): at java.lang.reflect.Method.invokeNative(Native Method)
02-27 22:53:13.047: E/AndroidRuntime(11744): at java.lang.reflect.Method.invoke(Method.java:511)
02-27 22:53:13.047: E/AndroidRuntime(11744): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-27 22:53:13.047: E/AndroidRuntime(11744): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-27 22:53:13.047: E/AndroidRuntime(11744): at dalvik.system.NativeStart.main(Native Method)
02-27 22:53:13.047: E/AndroidRuntime(11744): Caused by: java.lang.NullPointerException
02-27 22:53:13.047: E/AndroidRuntime(11744): at com.itcuties.android.reader.ItemDescriptionActivity.onCreate(ItemDescriptionActivity.java:18)
02-27 22:53:13.047: E/AndroidRuntime(11744): at android.app.Activity.performCreate(Activity.java:5104)
02-27 22:53:13.047: E/AndroidRuntime(11744): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
02-27 22:53:13.047: E/AndroidRuntime(11744): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
02-27 22:53:13.047: E/AndroidRuntime(11744): ... 11 more
和ItemDescriptionActivity.java
package com.itcuties.android.reader;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import com.itcuties.android.reader.R;
public class ItemDescriptionActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.item);
Bundle bundle = getIntent().getExtras();
String item_description = bundle.getString("description");
TextView desc = (TextView) findViewById(R.layout.item);
desc.setText(item_description);
}
}
应用程序正在获取 rss 数据,在列表视图中显示标题。我正在尝试在点击时添加显示描述,但点击时应用程序崩溃。什么会导致这些错误?