0
어떤 이유에서 내 expandableListView가 스크롤 또는 회전 변경시 충돌합니다.확장 가능한 목록 다중보기 유형으로보기 스크롤에 충돌 등
@Override
public int getGroupType(int groupPosition){
return comments.get(groupPosition).is_load_more;
}
@Override
public int getGroupTypeCount(){
return 2;
}
@Override
public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
ViewHolder holder = null;
View vi = convertView;
final commentItem item = getGroup(groupPosition);
if(vi == null) {
holder = new ViewHolder();
if(getGroupType(groupPosition) == 1){
vi = mLayoutInflater.inflate(R.layout.comments_loadmore, null);
holder.load_more = (Button)vi.findViewById(R.id.comments_load_more);
}else{
vi = mLayoutInflater.inflate(R.layout.comments_item, null);
holder.aq = new AQuery(vi);
holder.usericon = (ImageView)vi.findViewById(R.id.comments_item_userpic);
holder.username = (TextView)vi.findViewById(R.id.comments_item_username);
holder.fullname = (TextView)vi.findViewById(R.id.comments_item_fullname);
holder.content = (TextView)vi.findViewById(R.id.comments_item_content);
holder.commentc = (TextView)vi.findViewById(R.id.comments_item_commentcount);
holder.commentBtn = (FrameLayout)vi.findViewById(R.id.comments_item_comment);
holder.bumpBtn = (ImageView)vi.findViewById(R.id.comments_item_bump);
holder.bumpc = (TextView)vi.findViewById(R.id.comments_item_countbump);
holder.replyLayout = (LinearLayout)vi.findViewById(R.id.comments_item_replyLayout);
}
} else {
holder = (ViewHolder) vi.getTag();
}
if(getGroupType(groupPosition) == 1){
}else{
holder.aq.id(R.id.comments_item_userpic).image(item.user_img, true, false, 96, 0);
로그 캣 :
E/AndroidRuntime(9861): java.lang.NullPointerException
E/AndroidRuntime(9861): at test.com.CommentsActivity$commentAdapte
r.getGroupView(CommentsActivity.java:243)
E/AndroidRuntime(9861): at android.widget.ExpandableListConnector.getVie
w(ExpandableListConnector.java:446)
E/AndroidRuntime(9861): at android.widget.AbsListView.obtainView(AbsList
View.java:2268)
E/AndroidRuntime(9861): at android.widget.ListView.makeAndAddView(ListVi
ew.java:1790)
E/AndroidRuntime(9861): at android.widget.ListView.fillDown(ListView.jav
a:691)
E/AndroidRuntime(9861): at android.widget.ListView.fillSpecific(ListView
.java:1349)
E/AndroidRuntime(9861): at android.widget.ListView.layoutChildren(ListVi
ew.java:1641)
E/AndroidRuntime(9861): at android.widget.AbsListView.onLayout(AbsListVi
ew.java:2117)
E/AndroidRuntime(9861): at android.view.View.layout(View.java:14817)
E/AndroidRuntime(9861): at android.view.ViewGroup.layout(ViewGroup.java:
4631)
E/AndroidRuntime(9861): at android.widget.LinearLayout.setChildFrame(Lin
earLayout.java:1671)
E/AndroidRuntime(9861): at android.widget.LinearLayout.layoutVertical(Li
nearLayout.java:1525)
E/AndroidRuntime(9861): at android.widget.LinearLayout.onLayout(LinearLa
yout.java:1434)
E/AndroidRuntime(9861): at android.view.View.layout(View.java:14817)
E/AndroidRuntime(9861): at android.view.ViewGroup.layout(ViewGroup.java:
4631)
E/AndroidRuntime(9861): at android.widget.FrameLayout.layoutChildren(Fra
meLayout.java:453)
E/AndroidRuntime(9861): at android.widget.FrameLayout.onLayout(FrameLayo
ut.java:388)
E/AndroidRuntime(9861): at android.view.View.layout(View.java:14817)
E/AndroidRuntime(9861): at android.view.ViewGroup.layout(ViewGroup.java:
4631)
E/AndroidRuntime(9861): at com.android.internal.widget.ActionBarOverlayL
ayout.onLayout(ActionBarOverlayLayout.java:374)
E/AndroidRuntime(9861): at android.view.View.layout(View.java:14817)
E/AndroidRuntime(9861): at android.view.ViewGroup.layout(ViewGroup.java:
4631)
E/AndroidRuntime(9861): at android.widget.FrameLayout.layoutChildren(Fra
meLayout.java:453)
E/AndroidRuntime(9861): at android.widget.FrameLayout.onLayout(FrameLayo
ut.java:388)
E/AndroidRuntime(9861): at android.view.View.layout(View.java:14817)
E/AndroidRuntime(9861): at android.view.ViewGroup.layout(ViewGroup.java:
4631)
E/AndroidRuntime(9861): at android.view.ViewRootImpl.performLayout(ViewR
ootImpl.java:1987)
E/AndroidRuntime(9861): at android.view.ViewRootImpl.performTraversals(V
iewRootImpl.java:1744)
E/AndroidRuntime(9861): at android.view.ViewRootImpl.doTraversal(ViewRoo
tImpl.java:1000)
E/AndroidRuntime(9861): at android.view.ViewRootImpl$TraversalRunnable.r
un(ViewRootImpl.java:5670)
E/AndroidRuntime(9861): at android.view.Choreographer$CallbackRecord.run
(Choreographer.java:761)
E/AndroidRuntime(9861): at android.view.Choreographer.doCallbacks(Choreo
grapher.java:574)
E/AndroidRuntime(9861): at android.view.Choreographer.doFrame(Choreograp
her.java:544)
E/AndroidRuntime(9861): at android.view.Choreographer$FrameDisplayEventR
eceiver.run(Choreographer.java:747)
E/AndroidRuntime(9861): at android.os.Handler.handleCallback(Handler.jav
a:733)
E/AndroidRuntime(9861): at android.os.Handler.dispatchMessage(Handler.ja
va:95)
E/AndroidRuntime(9861): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(9861): at android.app.ActivityThread.main(ActivityThrea
d.java:5081)
E/AndroidRuntime(9861): at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime(9861): at java.lang.reflect.Method.invoke(Method.java:5
15)
E/AndroidRuntime(9861): at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:791)
E/AndroidRuntime(9861): at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:607)
E/AndroidRuntime(9861): at dalvik.system.NativeStart.main(Native Method)
자사가 holder.aq.id "에 충돌 (R.id.comments_item_userpic) 이미지입니다 (항목 나는이 활동
코드에 대한 두 가지보기 유형이 .user_img, true, false, 96, 0); " 왜 그런지 모르겠습니다. 누구든지 나를 도울 수 있을까?
"convertView가 이전에 getGroupView (int, boolean, View, ViewGroup)에 의해 생성 된 것은 아닙니다." 그래서 getChildView에 홀더를 설정하지 않으면 nullpointer가있을 것입니다. –