Android setOnCheckedChangeListener calls again when old view comes back

What version of Android are you using? It seems to be an issue for multiple components, especially with a checkedChange() method (CheckBox, RadioButton) and I can’t provide a good explanation why it is happening. I would assume because it registers the change of the position state and grabs the change of other properties? A similar … Read more

Put on the right the indicator of an ExpandableListView in Android

I don’t know a way to do that from XML but i’ll tell you a way to do so dynamically in your adapter. First you have to remove group indicator from your xml <ExpandableListView […] android:groupIndicator=”@null” /> Then in your layout of the parent add an imageview in the right position of your layout. Then … Read more

How to create Expandable ListView in Flutter

Try this: import ‘package:flutter/material.dart’; void main() => runApp(MaterialApp(home: MyApp(), debugShowCheckedModeBanner: false,),); class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { @override Widget build(BuildContext context) { return Scaffold( body: ListView.builder( itemCount: vehicles.length, itemBuilder: (context, i) { return ExpansionTile( title: Text(vehicles[i].title, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold, fontStyle: FontStyle.italic),), children: <Widget>[ … Read more

Android: ClassCastException when adding a header view to ExpandableListView

Ok, I figured this one out. I got rid of the runtime error by programatically setting the View’s LayoutParams to ListView LayoutParams, like so: headerView.setLayoutParams(new ListView.LayoutParams(ListView.LayoutParams.FILL_PARENT, ListView.LayoutParams.WRAP_CONTENT)); before adding the view. The reason being is found in the Android docs: http://developer.android.com/reference/android/view/View.html#setLayoutParams(android.view.ViewGroup.LayoutParams) which states that: These supply parameters to the parent of this view specifying how … Read more