Having Trouble Having More Than One Textview In A Expandablelistview
I seem to be having trouble initializing another textview in my expandablelist. I already have one, but I'm trying to add a second one in the same child. I made a new setter and
Solution 1:
All of your arrays are of different sizes but you're iterating over them in the same for
loop. Your bold[]
has 5
elements, names[]
has 10
, Images[]
only 8
; but, you're accessing them in your for
loop using the variable j
set to iterate 20
times (from 0
to 19
).
That's why you're getting the ArrayIndexOutOfBounds
exception. They should all be of the same length and match your size
variable to let you initialize size
number of Child
objects.
The problem lies with your
Group
class. Notice how both setName()
and setDetail()
are saving the data to Name
class member only. Hence, you are seeing two copies of your data.
publicclassGroup {
privateStringName;
privateStringDetail; // Add a new Detail memberprivateArrayList<Child> Items;
publicStringgetName() {
returnName;
}
publicStringgetDetail() {
returnDetail; // change getter
}
publicvoidsetDetail(String Detail) {
this.Detail = Detail; // change setter
}
publicvoidsetName(String name) {
this.Name = name;
}
...
}
Just add a new Detail
class member and update the corresponding getDetail()
and setDetail()
methods as I've done above to fix your problem.
Post a Comment for "Having Trouble Having More Than One Textview In A Expandablelistview"