expandable list view with checkbox for group and child - android

I have no idea on expandable list view concept in android. Above is the image i want to create. When user clicks on it, it should expand with child having check box. Even the group should have check box. When i click on group check box, all the child check box should be selected. I checked other posts they are using it in activity. How to implement this in a dialog? Thanks in advance.

How to implement this in a dialog?
You can create a Dialog using a DialogFragment and override onCreateView(). This allows you as much freedom with the Dialog UI as you have in any Activity, so the other SO posts you read will be very helpful there.
To get you started, see this guide on dialogs.

Related

list view animation

I have a list view with custom adapter. I'm trying to implement following
when a item in the list is clicked, only that item is expanded and show some info.
when it is clicked again, it goes back to the first state. can any one suggest a
way to achieve this.
thanks in advance
Use ExpandableListView.
It can help you.
ExpandableListView can expanded and back to the first state.
Also, you can custom inner layout.(some info)
please use it.

How to capture the checkbox options in a custom dialog?

My aim
I've made a custom dialog composed of a scrollable list view on top and an "OK" button at the bottom. For each row in the list view I've put a checkbox and I wish to capture the checkboxes that are selected when "OK" is clicked.
Problem
After checking out some tutorials online as well as some Q&A here, I've come up with a basic approach. What I did is
1. in the adapter for the list view, I attach the option name to each checkbox by setTag() when it is created
2. set up an onCheckedChangeListener in the adapter that puts the checked option into an array or remove the option if it's deselected
3. in the onCreateDialog within the main UI activity attach an OnClickListener to the "OK" button and make it retrieve the options array (obtained in step 2) from the adapter.
It works in the end; but I think it's too much trouble and not elegant. I thought about using onItemClickListener for the list view or putting a custom view into an AlertDialog (which offers better button/checkbox management), but gave up after some trials.
Is there anyone who can think of a better approach?
I needed a fairly complex dialog and I ended up writing it as a widget that extends RelativeLayout. When my calendar icon is clicked, it starts an activity which uses the widget, populates days in a calendar, depending on content from a database:
When you extend a layout, you have complete control over how it sizes itself, layout and what it draws on the canvas.
The activity implements OnTouchListener to pick up which date on the calendar has been touched - I'm sure the same could apply to adding images and picking up which checkboxes had been selected.
read about alertdialog with multichoice mode.

Extended list view: Show text input inside once clicked

I am working on a UI where I have a list view. Each row has 2 information. One is Product name and the other is product ID stacked one over other. So each row has 2 lines of data.
What i want to do with this:
Once a user clicks on each row, it will further expand and show one input and one spinner. So it is basically for putting in Quantity and unit of measure.
Please let me know if this is achievable and if I can refer to some example.
What I need is more like
Taskos To Do List | Task List
https://play.google.com/store/apps/details?id=com.taskos&hl=en
All i need is that the category will not be expandable. Only the items will be expandable. All i need is an example of such app and then I can take it forward.
I think it could be done... you would need to put the extra widgets in your row layout, populate them and hide them upon list creation, then in your onListItemCLick you could unhide them.
Note I have no idea if this would work, but it seems reasonable that it might and it's what I would try and do to achieve the goal.
listView cannot be expanded. however you can use an expandablelistView
But the kind of functionality you want cannot be done this way(I guess.).
You can use
registerForContextMenu("your list View");
to register your list view
onCreateContextMenu
for the kind of action you want to be performed in your case its dialog with EditText and Spinner to have input from user

Custom listview with popup issue in android

My custom listvalues are coming from java bean.
I have a popup inside custom list view with textview, check box and I have a list view in the activity. If the user selects a check box in the popup, I have to add the checked value to the list view. Can anybody tell me how to do this and give an example?
Thanks
Here are two links with possible solutions
multicolumn-listview-in-android
custom-listview-android-developer

Custom Listener for a ListView item

I have a View with a ListView appended, which actually uses a custom view item done programatically. Inside each list item I have a button which I need to track, to update another item in the view. It is only invalidated when you click on the list item button, not anywhere else in the list item.
So I thought of creating a custom Listener. I trigger it when the button is clicked, but I have no way to access it from the ListView activity.
Is there a way to simulate those setOnItem...Listener's using a custom listener? Thanks in advance
Please see this link to help with how to set onClickListener from within custom ListAdapters.
You can use the myButton.getTag() and myButton.setTag() to put and get data to/from your View/Button.
See this link as well to help with custom ListAdapters.
Here is another good example I found of how to use a custom adapter.

Categories

Resources