I am trying to implement an action that uses an ExpandableListView, and I got it so far, but now I have found strange behavior.
My activity is to record meals as indicated by the user. they have a choice of menus (breakfast, lunch and dinner - an outside group) that expand to show their contents. when a user clicks on an internal menu item, a dialog box appears asking for the quantity. as soon as they enter a number and reject the dialog, the text in the menu item changes to reflect the amount of this item that has been used up

The above image displays the list in a closed state.
, " " 1. , "" , 1.

. "" , , , "Qty X 1" ( "" )

, , . , , , , "Qty X 1", .
:
XML :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:id="@+id/childname"
android:paddingLeft="50dip"
android:textSize="14dip"
android:textStyle="italic"
android:layout_width="200dip"
android:textColor="@color/black"
android:layout_height="40dip"/>
<TextView android:id="@+id/qty_display"
android:text="-"
android:textSize="14dip"
android:textStyle="italic"
android:layout_width="50dip"
android:textColor="@color/black"
android:layout_height="wrap_content"/>
</LinearLayout>
, :
public boolean onChildClick(
ExpandableListView parent,
View v,
int groupPosition,
int childPosition,
long id) {
myDialog = new Dialog(this);
myDialog.setTitle("Food Item Qty");
myDialog.setContentView(R.layout.food_intake_dialog);
final Button ok = (Button)myDialog.findViewById(R.id.fi_ok_but);
Button cancel = (Button)myDialog.findViewById(R.id.fi_cancel_but);
String key = "item_id"+groupPosition+""+childPosition;
current_selected_food_item_id = Integer.parseInt(itemMap.get(key));
barQty = (TextView) v.findViewById(R.id.qty_display);
ok.setOnClickListener(new OnClickListener() {
public void onClick(View viewParam) {
EditText fiQty = (EditText) myDialog.findViewById(R.id.fiQty);
String qty = fiQty.getText().toString();
barQty.setText("Qty X "+qty);
FoodIntake.this.application.getFoodIntakeHelper().open();
FoodIntake.this.application.getFoodIntakeHelper().storeFoodIntakeLog(current_selected_food_item_id,qty,visit_id,remote_visit_id);
String log = FoodIntake.this.application.getFoodIntakeHelper().getFoodIntakeLog(visit_id);
FoodIntake.this.application.getFoodIntakeHelper().close();
list.setText("Food Intake Log:\n\n"+log);
myDialog.cancel();
}
});
, , , , .
, , , , - .