Hi Team
I have tried three level expandable list concepts in android. But in my
case three level list is based on some parent level. for that purpose i
checked group position values and then bind custom exapandable listview
according to that.
I have attached my sample code here
Code:
@Override
public View getChildView(int arg0, int arg1, boolean arg2, View arg3,
ViewGroup arg4) {
// TODO Auto-generated method stub
/*if(arg3==null)
{
arg3=layout.inflate(R.layout.row, null);
}
((TextView)arg3).setText(child.get(arg0));*/
if(arg0==1)
{
CustExpListview subObjects= new CustExpListview(ctx);
MySecondAdapter adapt = new MySecondAdapter(layout,child1, child2);
//adapt.setinflator((LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE),
MainActivity.this);
subObjects.setAdapter(adapt);
result = "Expand";
return subObjects;
}
else
{
if(arg3==null)
{
arg3=layout.inflate(R.layout.row, null);
}
((TextView)arg3).setText(child1.get(arg1));
result = "Other";
return arg3;
}
}
My Problem is like when i click any parents its working fine at first time.
But after selecting first parent afterwards i clicked any other parents in
the sense it will crash my app. It shows error like
01-22 10:02:38.226: E/AndroidRuntime(1459): FATAL EXCEPTION: main
01-22 10:02:38.226: E/AndroidRuntime(1459): java.lang.ClassCastException:
com.example.simpleexapndalelist2.CustExpListview
01-22 10:02:38.226: E/AndroidRuntime(1459): at
com.example.simpleexapndalelist2.MyFirstAdapter.getChildView(MyFirstAdapter.java:84)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.widget.ExpandableListConnector.getView(ExpandableListConnector.java:450)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.widget.AbsListView.obtainView(AbsListView.java:1294)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.widget.ListView.measureHeightOfChildren(ListView.java:1198)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.widget.ListView.onMeasure(ListView.java:1109)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.view.View.measure(View.java:8171)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:578)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.widget.RelativeLayout.onMeasure(RelativeLayout.java:362)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.view.View.measure(View.java:8171)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.view.View.measure(View.java:8171)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.view.View.measure(View.java:8171)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.view.View.measure(View.java:8171)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.view.ViewRoot.performTraversals(ViewRoot.java:801)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.os.Handler.dispatchMessage(Handler.java:99)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.os.Looper.loop(Looper.java:123)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
android.app.ActivityThread.main(ActivityThread.java:4627)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
java.lang.reflect.Method.invokeNative(Native Method)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
java.lang.reflect.Method.invoke(Method.java:521)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-22 10:02:38.226: E/AndroidRuntime(1459): at
dalvik.system.NativeStart.main(Native Method)
If find solution kindly give us.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group,