Text after "
I want to set ToggleButtons's RadioGroup in my ArrayAdapter. I have two options in my list, when I select a toggle button to turn on, I want the second to be closed.
Here is my ArrayAdapter code:
Public class MyAdapter extends ArrayAdapter & LT; String & gt; {Public MyAdapter (Reference Reference, Integer TextViewResourceId, ArrayList & quot; String & gt; Objects) {Super (Reference, TextVersource ID, Objects); } @ Override Public View getDropDownView (integer status, seeviewview, ViewGroup parent) {return getCustomView (status, convertview, parent); } @ Override public view GetView (int position, View Knhwartwu, ViewGroup parent) {getCustomView back (position, Knhwartwu, parent); } View public GetCustomView (last integer status, seeviewview, ViewGroup parent) {layoutInfleter Inflight = getActivity (). GetLayoutInflater (); Final viewholder holder = new viewer (); See line = inflater.inflate (R.layout.psip_settings_callquality_listitem, guardian, incorrect); Holder.itemTitle = (TextView) row.findViewById (R.id.txtCQViewItem); Holder.tmdsc = (textview) line.findvibid (rtttqvuidccc); Holder.itemToggle = (toggle button) row.findViewById (R.id.togCQViewItem); Holder.itemToggle.setTag (status); holder.itemToggle.setOnCheckedChangeListener (New OnCheckedChangeListener () {@Override public void onCheckedChanged (CompoundButton togButton, Boolean isChecked) {}}); Holder.itemTitle.setText (sSettingTitles.get (status)); Holder.itemDesc.setText (sSettingDesc.get (status)); Return line; } Private class viewer {TextView item; Text view itemsdoc; Toggle item confused; }}
XML
& lt; TextView android: id = "@ + id / txtCQViewItem" Android: Layout_width = "Match_parent" Android: Layout_height = "Wrap_content" android: text-style = "bold" Android: textcolor = "@ color / MiscBtnClick" Android: Layout_margin = " 5dp "/> & Lt; Android: layout_height = "wrap_content" Android: textcolor = "@color / MiscBtnClick" Android: Layout_toLeftOf: Android: layout_width = "wrap_content" android: layout_below = "@ + id / txtCQViewItem" android: id = "@ + id / txtCQViewDesc" = "@ + Id / togCQViewItem" Android: layout_margin = "5dp" /> & Lt; ToggleButton android: id = "@ + id / togCQViewItem" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: layout_below = "@ + id / txtCQViewItem" Android: layout_alignParentRight = "true" / & gt;
Any help is great will thank you
Private int selection = -1; Seeholder holder = null; If (convertView == empty) {holder = new viewholder () layoutInflator inflater = getActivity () GetLayoutInflater (); See line = inflater.inflate (R.layout.psip_settings_callquality_listitem, guardian, incorrect); Holder.itemTitle = (TextView) row.findViewById (R.id.txtCQViewItem); Holder.tmdsc = (textview) line.findvibid (rtttqvuidccc); Holder.itemToggle = (toggle button) row.findViewById (R.id.togCQViewItem); ConvertView = Row; ConvertView.setTag (holder); } And {holder = (seeholder) ConvertView.gettag (); } Holder.itemToggle.setTag (status); HolderkitemToggleksetOnCheckedChangeListener (new on Cheked Change Listnr () {@ converting overhead on Cehrn public void (Compound button to Buttn, Czech Boolean) {if (Czech and amp; status! = Selection) {select = position; NotificationDetateCheng ();} and if (! IsChecked & amp; Status == Selection) {Selection = -1}}}); Holder.itemToggle.setChecked (position == selection); Holder.itemTitle.setText (sSettingTitles.get (status)); Holder.itemDesc.setText (sSettingDesc.get (status)); Return Convertview;
You do not need to create each and every time from the sequences since using ListView again. Follow the code I suggested and I know that it is not working or working.
Comments
Post a Comment