Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to place a text in expandable list item dyanmically?
    primarykey
    data
    text
    <p>i hava an app where i required to enter a text dynamically at run time? please say me how can i do it? I tryed below like that but it changed when i expand other parent. thanks you</p> <pre><code> @Override public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.showcat_sub, null); } final TextView tt = (TextView) v.findViewById(R.id.showMenuName); final TextView tv = (TextView) v.findViewById(R.id.showQty); //final CheckBox cb1 = (CheckBox) v.findViewById(R.id.chkShowItems); //ImageView img = (ImageView) v.findViewById(R.id.imgShowItems); tt.setText(getChild(groupPosition, childPosition).toString()); tt.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT); if (y == groupPosition &amp;&amp; z == childPosition &amp;&amp; y != 0) { tt.setBackgroundColor(Color.MAGENTA); } else { tt.setBackgroundColor(Color.TRANSPARENT); } tt.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub y = groupPosition; z = childPosition; /* List&lt;HashMap&lt;String, String&gt;&gt; curList=list.get(groupPosition); final HashMap&lt;String, String&gt; map=curList.get(childPosition); tvMenuName = (TextView) v.findViewById(R.id.menu); tvDescName = (TextView) v.findViewById(R.id.desc); */ final Dialog dialog = new Dialog(CategoriesActivity.this); dialog.setContentView(R.layout.text_enter_dialog); dialog.setTitle("Enter Quantity"); final EditText input = (EditText) dialog.findViewById(R.id.edCategoryDialog); final EditText by = (EditText) dialog.findViewById(R.id.edByCategoryDialog); Button okButton = (Button) dialog.findViewById(R.id.btnAddCategoryDialog); System.out.println("inside dialog_started"); okButton.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { System.out.println("inside dialog_started ok"); String value=""; String value1 = input.getText().toString().trim(); String value2 = by.getText().toString().trim(); if(value2!=""&amp;&amp;!value2.equals("")){ value=value1+"/"+value2; } else{ value=value1; } try { /* text.setText(value); color.setText("selected"); color.setBackgroundColor(Color.LTGRAY); OrderlistData data = new OrderlistData(tvMenuName.getText() .toString(), value1); if(orderlist1.contains(data)){ orderlist1.remove(data); } boolean b=checkExistence(tvMenuName.getText().toString(),value1); if(b) orderlist1.add(data); */ //map.put("qty",value); tv.setText(getChild(groupPosition, childPosition).toString()+value); } catch (Exception e) { Toast.makeText(CategoriesActivity.this, "Enter a valid quantity.....", Toast.LENGTH_LONG); } dialog.dismiss(); // app specific code } private boolean checkExistence(String string,String value1) { try { HashMap&lt;Integer, List&lt;OrderlistData&gt;&gt; orederMap = ConText .getContextMap(); List&lt;OrderlistData&gt; orderlist4 = orederMap.get(ConText.currentPos); for (OrderlistData orderlistData : orderlist4) { orderlistData.setNoOfItems(value1); if(orderlistData.getItemName().equals(string)){ return false; } } } catch (Exception e) { System.out.println("error is ......."+e); } return true; } }); Button cancelButton = (Button) dialog.findViewById(R.id.btnCancelCategoryDialog); cancelButton.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { dialog.dismiss(); } }); dialog.show(); } }); return v; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload