这是我的代码:
holder.bookbtn=(Button)view.findViewById(R.id.bookbtn);
bookbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
book.startActivity(new Intent(book,PaymentForm.class));
}
});
这是错误消息:
04-11 12:35:41.271: E/AndroidRuntime(941): FATAL EXCEPTION: main 04-11
12:35:41.271: E/AndroidRuntime(941): java.lang.NullPointerException
04-11 12:35:41.271: E/AndroidRuntime(941): at
com.example.hotelsearch.NewsRowAdapter.getView(NewsRowAdapter.java:156)
04-11 12:35:41.271: E/AndroidRuntime(941): at
android.widget.AbsListView.obtainView(AbsListView.java:2033) 04-11
12:35:41.271: E/AndroidRuntime(941): at
android.widget.ListView.onMeasure(ListView.java:1127) 04-11
12:35:41.271: E/AndroidRuntime(941): at
android.view.View.measure(View.java:12724) 04-11 12:35:41.271:
E/AndroidRuntime(941): at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
04-11 12:35:41.271: E/AndroidRuntime(941): at
android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1369)
04-11 12:35:41.271: E/AndroidRuntime(941): at
android.widget.LinearLayout.measureVertical(LinearLayout.java:660)
04-11 12:35:41.271: E/AndroidRuntime(941): at
android.widget.LinearLayout.onMeasure(LinearLayout.java:553) 04-11
12:35:41.271: E/AndroidRuntime(941): at
android.view.View.measure(View.java:12724) 04-11 12:35:41.271:
E/AndroidRuntime(941): at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
04-11 12:35:41.271: E/AndroidRuntime(941): at
android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1369)
04-11 12:35:41.271: E/AndroidRuntime(941): at
android.widget.LinearLayout.measureVertical(LinearLayout.java:660)
04-11 12:35:41.271: E/AndroidRuntime(941): at
android.widget.LinearLayout.onMeasure(LinearLayout.java:553) 04-11
12:35:41.271: E/AndroidRuntime(941): at
android.view.View.measure(View.java:12724) 04-11 12:35:41.271:
E/AndroidRuntime(941): at
android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1163)
04-11 12:35:41.271: E/AndroidRuntime(941): at
android.widget.FrameLayout.onMeasure(FrameLayout.java:293) 04-11
12:35:41.271: E/AndroidRuntime(941): at
android.widget.ScrollView.onMeasure(ScrollView.java:312) 04-11
12:35:41.271: E/AndroidRuntime(941): at
android.view.View.measure(View.java:12724) 04-11 12:35:41.271:
E/AndroidRuntime(941): at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
04-11 12:35:41.271: E/AndroidRuntime(941): at
android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1369)
04-11 12:35:41.271: E/AndroidRuntime(941): at
android.widget.LinearLayout.measureVertical(LinearLayout.java:660)
04-11 12:35:41.271: E/AndroidRuntime(941): at
android.widget.LinearLayout.onMeasure(LinearLayout.java:553) 04-11
12:35:41.271: E/AndroidRuntime(941): at
android.view.View.measure(View.java:12724) 04-11 12:35:41.271:
E/AndroidRuntime(941): at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
04-11 12:35:41.271: E/AndroidRuntime(941): at
android.widget.FrameLayout.onMeasure(FrameLayout.java:293) 04-11
12:35:41.271: E/AndroidRuntime(941): at
android.view.View.measure(View.java:12724) 04-11 12:35:41.271:
E/AndroidRuntime(941): at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
04-11 12:35:41.271: E/AndroidRuntime(941): at
android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1369)
04-11 12:35:41.271: E/AndroidRuntime(941): at
android.widget.LinearLayout.measureVertical(LinearLayout.java:660)
04-11 12:35:41.271: E/AndroidRuntime(941): at
android.widget.LinearLayout.onMeasure(LinearLayout.java:553) 04-11
12:35:41.271: E/AndroidRuntime(941): at
android.view.View.measure(View.java:12724) 04-11 12:35:41.271:
E/AndroidRuntime(941): at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
04-11 12:35:41.271: E/AndroidRuntime(941): at
android.widget.FrameLayout.onMeasure(FrameLayout.java:293) 04-11
12:35:41.271: E/AndroidRuntime(941): at
com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2092)