Android :: Implement An Activity That Uses ExpandableListView

Sep 3, 2010

Im trying to implement an activity that uses ExpandableListView and I have gotten so far but now I have found some strange behavior.

My activity is meant to record food intake as specified by the user. they have a choice of menus (breakfast, lunch and dinner - the outer group) which expand to show their contents.
when a user clicks on an inner menu item a dialog appears asking them for the qty. once they enter a qty and dismiss the dialog the text on the menu item changes to reflect the quantity of that item that has been consumed

The above image shows the list in a closed state.

Below is the list after I have opened the lunch menu and clicked on 'Potato Chips' and indicating a Quantity of 1. As you can see the 'Potato' itemtext has now been changed to reflect the Qty of 1.

The strange part happens now. if I click on 'Lunch' and close the list and then click on it again re-opening it, the 'Qty X 1' text has jumped to another item (Milk)

Each time I open and close the list it jumps back and forth between the two items. Also if I open up other items, such as breakfast, I find that they too have now gotten items with 'Qty X 1' even though I havent clicked them.

The bits of code that are relevant are as such:

The XML for a child element:

CODE:................

The code thats triggered on clicking a child element:

CODE:..................

The above code opens a dialog, accepts a value for quantity, appends the list element to reflect this, also saves to database and sets a textview with the selected item and quantity.

Android :: implement an activity that uses ExpandableListView


Android : Implement Long Click Event For ExpandableListView?

Feb 2, 2010

Can any one please suggest me how to implement the long click (onItemLongClick()) for the Expandable list view?

View 3 Replies View Related

Android :: Create A ExpandableListView In One Activity?

Nov 2, 2010

I'm trying to create a ExpandableListView in one activity. I've looked in apis demos, and I've created ExpandableListView. The problem is, that I need to have this ExpandableListView in activity that is already created, and not in a new one.

I've used this code:

CODE:..............

View 3 Replies View Related

Android :: ExpandableListView - Exception In The OnCreate Method Of An Activity

Mar 3, 2010

I am encountering an exception in the onCreate method of an activity.

CODE:.......

The onCreate method is as below.

CODE:......

The layout view XML is as below.

CODE:..........

I've already changed the ID of the ExpandableListView to "list". But it is not effective.

View 4 Replies View Related

Android :: Implement Tab Layout Using Only One Activity?

Sep 14, 2010

Official android dev website says that:You can implement your tab content in one of two ways: use the tabs to swap Views within the same Activity,.....http://developer.android.com/resources/tutorials/views/hello-tabwidget.html

I just wanna use tabs to swap views, no more than one activity. is there any sample code?

View 2 Replies View Related

Android :: Best Way To Implement An Activity That Lists Recipes

Feb 15, 2010

I'm working on my first Android app, and would appreciate any guidance to make sure I'm doing this the best way. Basically I want an Activity to list recipes. Eventually I'll have another Activity to display an individual recipe selected from the list, but I'm not worrying about that yet.

The list of recipes should show each recipe's title, description, rating, and date added. For each recipe in the list I'd like the title on the top left of the list entry, rating on the top right, description on the bottom left, and date added on the bottom right. I may want to add photo, icons representing properties of the recipe (e.g. vegetarian), etc. The makes me think that each item in the list should be a TableLayout.

With all that in mind, here's what I'm planning to write:

1. Write class RecipesDataAdapter extends BaseAdapter. Override the getView() method to return an instance of TableLayout. Populate each instance of TableLayout with two TableRows, the first row containing cells for title and rating, and the second row containing cells for description and date added. For now I'll just pass the Recipe instances to the adapter in an array.

2. Write class ListRecipesActivity that extends ListActivity. Override the onCreate() method to obtain instances of the Recipe class and call the setListAdapter() method with an instance of the RecipesDataAdapter class.

Notice that all this is done in code without any layout XML files. All the examples of Activities that I've seen use a layout XML file and call setContentView(R.layout.layout_name) but I'm not sure if I need to do that for this, or even how I would do that considering my main Activity is a list of non-trivial things (TableLayout).

View 8 Replies View Related

Android :: How To Implement Generic Activity - List And Map Activities?

Oct 13, 2010

I want to display the same options menu on all of my application's activities. I created a generic Activity that implements the menu, and all my further activies extend it. The problem: when I need to extend other specific activities, like ListActivity and MapActivity, I can't figure out how to extend the generic activity and add the List or Map behaviour to the new class. To deal with the issue I had to create three different generic activities, each extending Activity, ListActivity and MapActivity.I've tried creating an abstract activity but it doesn't work, I would need to extend two classes at the same time. I could try interfaces but since I can't implement methods, I would have to paste the menu implementation all over the second-level classes, right?

View 1 Replies View Related

Android :: Implement Touch Events On Activity And Button On Droid?

Apr 23, 2010

I have an Android activity with an ImageButton. I would like to execute some logic when the button is clicked and show a different image for the pressed state, but also receive the touch event on the activity.

By default only the button receives the touch event. If I set the clickable attribute of the button to false then only the activity receives the touch event.

What's the best way to implement the touch event in the activity and the click in the button?

View 2 Replies View Related

Android :: Implement Master And Child Page Like Activity In Droid?

Jan 28, 2010

I want to place a common banner and menu on each Activity with footer too.

Can anyone guide me how can I implement master and child page like asp.net in Android?

View 2 Replies View Related

Android :: Xml Parser With Expandablelistview

Oct 27, 2010

I need to implement an xml parser and the parsed result into an expandablelistview.

View 1 Replies View Related

Android :: ExpandableListView Won't Redraw

Jul 29, 2009

I have an expandable list view with a static array for the group data and an SQLite database for the child data. It is implemented with the BaseExpandableListAdapter and works great, except, when I edit the database to delete or add children to the list I do not see the changes onscreen. It looks like I can use the registerDataSetObserver method to notify the adapter and expandable list of a data change. What I have to do in the callback to make Android redraw the list after data changes is what I need to know. Can I do it? Documentation on this part of the SDK is a bit sparse and expandable list view example code is not a good match. Can anyone offer advice on how to use a DataSetObserver? It feels like I have to switch over to a Cursor type adapter.

View 2 Replies View Related

Android :: Set ChlidDivider In ExpandableListView?

Dec 15, 2009

This is my ExpandableListView

CODE:..............

When I execute this in emulator, green(childDivider color) is all over the place.

It seems if childDivider is ColorDrawable, it has no bound.

View 2 Replies View Related

Android :: Filter In ExpandableListView?

Mar 18, 2010

I have an ExpandableListView with several groups and each group contains several children. I want to make this list searchable, just like a regular list view. I have a SimpleCursorTreeAdapter (mAdapter) for this expandlable list.

I tried to use the built in list filter using:

CODE:.......

The above code does not work for filtering.

How can I implement the search/filter functionality?

View 2 Replies View Related

Android :: Animating The ExpandableListView?

Sep 17, 2010

Is it possible to animate the expanding and collapsing of the groups in a ExpandableListView.

View 3 Replies View Related

Android :: Onchildclick In ExpandableListView?

Jun 17, 2009

I need a solution how to get the OnChildClick working for my ExpanableListActivity.

when starting of this project the Listener was working, but now i get nothing out of it?

i tried setting the listener through: "getExpandableListView().setOnChildClickListener(this);" at several point, but it isn't responding.

Here's the source code:

CODE:............

View 3 Replies View Related

Android :: LinearLayout In ExpandableListView

Jul 18, 2010

I want to inflate a childView of ExpandableChildView component.

Code:.............

Where linearOpt is a vector that contains a lot of LinearLayout objects that I have instantiated.

CODE:..

This is R.layout.itemrow xml:

But I received this error:

CODE:.................

View 1 Replies View Related

Android :: Expandablelistview Can Not Use NotifyDataSetChanged()?

Oct 20, 2010

I want to refresh my expandablelistview, but it seems there is no way to use notifyDataSetChanged()? how can i refresh my expandablelistview?

View 2 Replies View Related

Android :: ExpandableListView Context Menu

May 14, 2010

I'm trying to add a context menu to my ExpandableListView. I've implemented onCreateContextMenu() and onContextItemSelected() but if I hold my finger on a menu item context menu doesn't appear. What's my mistake?

View 1 Replies View Related

Android :: ExpandableListView - Is Conditional Expansion Possible

Aug 12, 2010

I have an ExpandableListView bound to a SQLite database. To simplify things, lets assume the database contains two columns: title and body. In the ExpandableListView, there is a group for each title, and a childfor each corresponding body.

Now to make things more interesting, some of the rows in the SQLite database do not have a body (that is... they only have a title). As you can see, if there is no body, then there is no reason to expand the group... because the child will be empty (i.e. String body == "").

I'm searching for a way to catch a situation like this, and skip the group's expansion. I don't want a blank child to be expanded. To put it in psuedo code, I want something like this:

CODE:...............

View 1 Replies View Related

Android :: Refreshing Data In ExpandableListView?

Apr 24, 2010

My problem is when I want to refresh data in ExpandableListView while being in that current activity. I create adapter and when I want to add new data to list I call again constructor of that adapter(it is my private variable) with all new data....and then I call onContentChanged() method to redraw my list.
But what happens is that I cant expand my list any more...like it is blocked or something and logcat isn't saying anything...

This is the code that i call after setting new data in arraylists and maps:

CODE:....................

View 1 Replies View Related

Android :: Possible For The Child Of An ExpandableListView Also Be A Parent?

Nov 5, 2010

Is it possible for the child of an ExpandableListView also be a parent?

For example, I need something like the following: ParentA ChildA ChildB ParentB ChildC GrandchildA? GrandchildB? ParentC

View 4 Replies View Related

Android :: ExpandableListView Indicator Over My Text

Dec 2, 2009

I'm using an ExpandableListView in one of my activity in a RelativeLayout

CODE:.............

And I'm using a custom expandableListAdaptaer which group view is:

CODE:............

(Found on examples of API_Demos, ExpandableList1)

A user of my application report me this photo http://binomed-android-project.googlecode.com/issues/attachment?aid=-... As you can see, the indicator of group items is over the text of group item despite the padding of 36...

And if I'm running emulator WVGA800 or an emulator with "abstracted LCD density" to 240 I have the same problem, but with my phone (HTC G1), I don't have any problem.

What is strange is that I try the application API_Demo with an emulator WVGA800 or an emulator with "abstracted LCD density" to 240 and I go to ExpandableList1 activity and all is alright !

I also try to copy the inner class available in ExpandableList1 for adapter and I launch it into my activity and I also have the problem see on photo

I am forced to manage density into my adapters in order to adjust the padding?

View 3 Replies View Related

Android :: Customize The Parent In An ExpandableListView?

Sep 16, 2010

I'm trying to customize the parent(or header) for an expandablelist and I haven't found a solution yet. I want an imageview and two textviews in the parent. This is driving me insane atm.

View 2 Replies View Related

Android :: ChoiceMode Compatible With ExpandableListView?

May 12, 2010

Is it possible to make a multiple choice list with android:choiceMode="multipleChoice" or setChoiceMode(ListView.CHOICE_MODE_MULTIPLE) on an ExpandableListView? I am able to do this with CheckBoxes on a plain ListView, but it doesn't seem to be working with ExpandableListView. In the latter, clicking the list item (either parent or child) does not affect the checkbox as it does in the former.

I have noticed that it is possible to click exactly on the checkbox to make it toggle, but this is a very small target.

View 1 Replies View Related

Android :: Getting Item's Index From Id In ExpandableListView

Jun 4, 2010

I need to get item's index(position) knowing its ID while using ExpandableListView. Is there any way to do this without making complete hash id->index and searching it?

View 1 Replies View Related

Android :: Disable Collapsing Of ExpandableListView

Aug 11, 2010

The default behavior of ExpandableListView is to collapse a group when its header is clicked. Is it possible to prevent this from happening?

I've tried: Setting OnTouchListener on the list. This interferes with scrolling. Setting an OnGroupClickListener on the list (in onCreate()). This works for all clicks after the first.

Why might the OnGroupClickListener miss the first click?

View 2 Replies View Related

Android :: Use An Expandablelistview As A Dropdownview For A Spinner ?

Oct 5, 2010

I have a 2d array of strings. I would like to use a spinner to allow users to select values from the 2nd lvl of the array but I would like to display the selection options in a expandablelistview using the values of the 1st lvl of the array as category headers. Is this possible, how this should be implemented ?

View 1 Replies View Related

Android : Switch From A TableLayout To An ExpandableListView?

May 26, 2010

Is it possible to switch from a TableLayout to an ExpandableListView? How? I tried using ViewFlipper but the fact that ExpandableListView doesn't use XML threw a wrench in it.

View 1 Replies View Related

Android :: Change Value Of ExpandableListView's Cell On Click

May 4, 2010

I have the following problem: I would like to change value of ExpandableListView's cell on click. How should I do that?

Here is what I'm using:

CODE:............

Application is in progress stage, so attrVal will contain several attributes ( which can be put or not depend on some logic), so I'm using this type of adapter and this way of filling cells' data.

fieldsInList - external variable of LinkedHashMap type.

I have a function which can change one of the member's of fieldsInList variable. How should I notify my expListAdapter or ExpanableListView to be refreshed?

View 2 Replies View Related

Android :: Setting Focus Programatically In ExpandableListView

Aug 28, 2010

I have subclassed ExpandableListActivity to create an activity that presents a simple tree view of the 'world at large' and allows the user to select one for further use by the app. I am having trouble setting focus programatically. One thing that baffles me is that I can use the D-pad to set focus on any of the child or group items in my ExpandableListView, but inside my onChildClick() callback, isFocusable() returns false. If I can set focus with the D-pad, how can isFocusable() return false?

My goal is to avoid having the user have to touch individual ExpandableListView entries to select them and to provide a couple of buttons to move the focus up and down inside the list. I want selection to be easy for folks with no D-pad or with a phone that only presents the D-pad when in landscape mode (e.g. Droid) .

Is there some way I can programatically inject D-pad key clicks into my app input event stream?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved