Adding Buttons to expendableListView as last Child

Adding Buttons to expendableListView as last Child

Content Index :

Adding Buttons to expendableListView as last Child
Tag : android , By : MJRider
Date : November 25 2020, 07:22 PM

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

how to stop addContentView to hide the top of my expendablelistview?

Tag : android , By : Jeskl
Date : March 29 2020, 07:55 AM
Any of those help In an ExpandableListActivity you have an ExpandableListView. Period. When you set the Adapter to it, You can't then add other View on top of that.(I'm almost sure this isn't good practice)
My advice is that you create an ExpadableListView on the side and put it into a Layout(with the other things you want) that is loaded into a clean plain Activity.

Android - cannot refresh ExpendableListView, it freezes

Tag : android , By : Monev
Date : March 29 2020, 07:55 AM
around this issue I solved this by using runOnUiThread in my addTeam() instead and it worked flawlessly.

Use onChildClickListener with ExpendableListView

Tag : android , By : platformNomad
Date : March 29 2020, 07:55 AM
I wish did fix the issue. How do you use onClickListener with Expendable List view in such a way that clicking a child item creates a new Activity?
onChildClick (ExpandableListView parent, View v, int groupPosition, int childPosition, long id)

Trying to use TextView as a button to move to another activity in ExpendableListView

Tag : android , By : PatrickSimonHenk
Date : March 29 2020, 07:55 AM
To fix the issue you can do I want to go to my secondActivity when i click on the drop down list values from the ExpendableListView. i have seen examples to show toast messages but none to move to another activity.I am quite new to android.please tell me how can i do that. i have tried intent class also.thanks in advance. , In your onClick(View v) method, write:
Intent intent = new Intent(context, SecondActivity.class);
// optionally, check if the view is an instance of TextView
String text = ((TextView) v).getText().toString();
intent.putExtra(SOME_CONSTANT, text);
Intent intent = getIntent();
String text = intent.getStringExtra(SOME_CONSTANT);

Values of counter changes after scrolling ExpendableListView

Tag : java , By : Gilmar Souza Jr.
Date : March 29 2020, 07:55 AM
wish of those help I have an ExpandableListView of items and on list item I have TextView with two buttons to increment or decrements the value in TextView on clicks. The problem occurs every time I try to scroll the list. If I increment one item and then scroll the list the values get mixed (becouse the ListView keeps recycling its views) and I don't know how to fix it. , Try this adapter:
public class ExpandableListAdapter extends BaseExpandableListAdapter {

class ViewHolder {
    TextView childText;
    TextView counterText;
    Button addItemButton;
    Button deleteItemButton;

class ChildItem{
    String name;
    int quantity;
    ChildItem(String name, int quantity){
        this.name = name;
        this.quantity = quantity;

class Pos{
    int group;
    int child;
    Pos(int group, int child){
        this.group = group;
        this.child = child;

private Context context;
private List<String> listDataHeader;
//private HashMap<String, List<String>> listHashMap;
private HashMap<String, List<ChildItem>> listChildMap;

public ExpandableListAdapter(Context context, List<String> listDataHeader, HashMap<String, List<String>> listHashMap) {
    this.context = context;
    this.listDataHeader = listDataHeader;
    listChildMap = new HashMap<>();
    for(int i=0; i<getGroupCount(); i++){
        List<ChildItem> listTemp = new ArrayList<>();
        for(int j=0; j<listHashMap.get(listDataHeader.get(i)).size(); j++){
            listTemp.add(new ChildItem(listHashMap.get(listDataHeader.get(i)).get(j), 0));
        listChildMap.put(listDataHeader.get(i), listTemp);

public int getGroupCount() {
    return listDataHeader.size();

public int getChildrenCount(int groupPosition) {
    return listChildMap.get(listDataHeader.get(groupPosition)).size();

public String getGroup(int groupPosition) {
    return listDataHeader.get(groupPosition);

public ChildItem getChild(int groupPosition, int childPosition) {
    return listChildMap.get(listDataHeader.get(groupPosition)).get(childPosition);

public long getGroupId(int groupPosition) {
    return groupPosition;

public long getChildId(int groupPosition, int childPosition) {
    return childPosition;

public boolean hasStableIds() {
    return false;

public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
    String headerTitle = getGroup(groupPosition);
    if(convertView == null) {
        LayoutInflater inflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.list_group, null);
    TextView listHeader = (TextView) convertView.findViewById(R.id.list_header);
    listHeader.setTypeface(null, Typeface.BOLD);
    return convertView;

public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
    ViewHolder viewHolder;
    if(convertView == null) {
        LayoutInflater inflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.list_item, null);
        TextView textListChild = (TextView) convertView.findViewById(R.id.list_item_header);
        TextView itemsCounter = (TextView) convertView.findViewById(R.id.items_counter);
        Button addItemButton = (Button) convertView.findViewById(R.id.plus_btn);
        viewHolder = new ViewHolder();
        viewHolder.childText = textListChild;
        viewHolder.counterText = itemsCounter;
        viewHolder.addItemButton = addItemButton;
    } else {
        viewHolder = (ViewHolder) convertView.getTag();
    ChildItem child = getChild(groupPosition, childPosition);
    viewHolder.counterText.setText("" + child.quantity);
    viewHolder.addItemButton.setOnClickListener(new View.OnClickListener(){
        public void onClick(View v) {
            Pos pos = (Pos)v.getTag();
            ChildItem selectedItem = getChild(pos.group, pos.child);
            selectedItem.quantity = selectedItem.quantity + 1;

    viewHolder.addItemButton.setTag(new Pos(groupPosition, childPosition));
    return convertView;

public boolean isChildSelectable(int groupPosition, int childPosition) {
    return true;
Related Posts Related QUESTIONS :
  • Fragment is reloaded each time after rejecting location permission
  • How to read ViewModel data from sttrings.xml list of items
  • Flutter doctor does not see vs code ,VS code does not detect flutter/bin
  • How to build aar in flutter
  • Is displayMetrix xdpi and ydpi accurate?
  • How to detect doubletap on a View?
  • how to play an encrypted file in Android
  • Android: keytool error on the command line when locating debug.keystore
  • Android paint/canvas issue; drawing smooth curves
  • Problems with starting an activity in onStart
  • Performance of map overlay in conjunction with ItemizedOverlay is very poor
  • How to change android indeterminate ProgressBar color?
  • How do I change the Mobile Country Code (MCC) in the Android Emulator?
  • Stop Progressbar manual scrolling in Android
  • Android: download large file
  • Android : uploaded .apk file to server but cant download that .apk file
  • How do I distribute Android app to beta tester without using Market
  • Android Unable to launch the Inbox from a notification
  • Android: Ringer mode changed to silent doesn't stop the phone vibrating
  • Change the side the text appears on a radio button
  • Check the memory usage anp cpu and power of an application in android
  • What is the String 'volumeName' argument of MediaStore.Audio.Playlists.Members.getContentUri referring to?
  • Playing Multiple sounds at the same time in Android
  • Android: how to change the time in emulator?
  • close the soft key pad when i click on other views in android
  • Setting the position within a spinner
  • How to play ringtone/alarm sound in Android
  • How to adjust text font size to fit textview
  • "Android 2.x" vs "Google APIs" for Android AVD Setup
  • How to center buttons on screen horizontally and vertically plus equidistant apart?
  • Discrete seekbar in Android app?
  • Gradle Build Fails - Illegal exception table range in class file com/google/wireless/android/sdk/stats/GradleBuildMemory
  • register has type Long (High Half) but expected Long (Low Half)
  • Is it good idea to use Dispatcher.Main with delay( )?
  • WebView and Advanced View is Not loading partiucalr URL
  • How to show three dots at the end of text view
  • Is it possible to run macros within Android Studio project?
  • Adding a button with default appearance but changed background color
  • What is best way to show notification at a certain time in Android?
  • Jetifier not working when library uses android component and app uses androidx component
  • How can I write the contents of an image in a filesystem
  • Retrieve a list of images from the Database and display them using a ListView?
  • java.lang.SecurityException: my location requires permission ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION
  • Timer/hourglass wont stop
  • How can I make AndroidX the default library for new Android projects?
  • Is it okay to delete buildToolsVersion android studio because of a warning in the Asyncstorage library?
  • Can I call a class that doesn't have an activity withIntent?
  • Android TextView fontFamily not working when set via TextAppearance
  • Unable to find nearby places
  • Is there any way to launch my application right away without 'Ok Google"?
  • Places api set location biased based on current location
  • Layout Preview is not displaying layout when Material Design is added
  • How do I resolve this diamond problem in Kotlin?
  • How to update the custom value in a view model object
  • How to stop refreshing/re-creating activity when updating Firebase data using setValue?
  • Manifest Permissions vs App Setttings Permissions
  • NumberFormatException in Try-Catch while converting String to Int
  • How to pass observable fields through include tag?
  • Next button on Android keyboard not submitting form
  • Does Firestore support automatic functions for updates?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com