Note that there are some explanatory texts on larger screens.

plurals
  1. POIs it possible to have different child views for an ExpandableListView in android based on a value from the parent adapter?
    primarykey
    data
    text
    <p>In the app I'm working on, I currently use a button to open a new activity that has a simple filterable listview in it. When the user clicks on a row in the listview, the selected value is returned back to the previous Activity to then have something done with it. This means I have two activities to do one function. </p> <p>I was looking for a way to combine the two elegantly, and think that an expandablelistview is the way to go, but I'm not sure about one thing: Can the getChildView be overridden (custom expandablelistview) to inflate a different view based on a value in the parent group adapter?</p> <p>My adapter selects two values from an sqlite database, an integer called "Type" and a String called "Move". I only show the "Move", but bind the "Type" to an TextView that's hidden. If I implement a single expandablelistview, I would need to somehow pass the "Type" to the drop down, so that it could display a different child view (allowing user to enter either weight, time, or reps, based on a type value of "1", "2", or "3". </p> <p>Is this possible with a custom ELV that overrides the getchildview method? I see that you can get the parent position, and the child position, but besides using a global variable when the parent is clicked, I can't see anything that is passed to the child to know the value, text, etc that was the parent?</p> <p>I found a nice implementation as well here: <a href="https://github.com/tjerkw/Android-SlideExpandableListView" rel="nofollow noreferrer">https://github.com/tjerkw/Android-SlideExpandableListView</a> </p> <p>But it seems too complex to try and override that, so I'm just going to try a standard Expandable List View if it's possible.</p> <p>Thankss! </p> <p>Edit: Here's a bad mockup of what I'm talking about. First drop would have a view with just a box and a button, second view might have a box and a button, but third view has two boxes, one for weight, one for reps, and then a button.:</p> <p><img src="https://i.stack.imgur.com/lAIy2.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload