android-radiobutton

Android - Get values of Radio Buttons in a ListView

白昼怎懂夜的黑 提交于 2019-12-12 03:38:46
问题 I designed a scenario which, according to my understanding of Java, should have worked out fine but unfortunately didn't. The scenario is explained in code: ListViewAdapter public final class ListViewAdapter extends BaseAdapter { private Context context; private RadioGroup[] radioGroups; private List<String> listOfData; public OneForAllListViewAdapter(Context context, List<String> listOfData) { super(); this.context = context; this.radioGroups = new RadioGroup[listOfData.size()]; this

dynamic radio buttons are not working when click the radio group to checkchangelistner

﹥>﹥吖頭↗ 提交于 2019-12-12 02:58:23
问题 I created the radio buttons dynamically and set them in the radio group and it is working good but when i click the radio buttons to get the value but onclick is not working here is the code: in this when i click on checked change listner there is nothing happens i also taost it to show either onclick is working or not but nothing prints. please help thanks in advance. try { Thread.sleep(1000); voterNA=dbcon.GetVoterNA(id); LinearLayout ll=new LinearLayout(context); ll.setOrientation

Android requestfocus on unchecked radiogroup and show error beside each unchecked radiogroup

非 Y 不嫁゛ 提交于 2019-12-11 17:39:29
问题 I have set onclick event on a button(Submit). If the radio buttons of a radio group is not selected then I try to Toast message and focus/listview scroll the first unchecked radio group with error image beside or text(please select answer) as well as show error beside all unchecked radiogroup. I was able to achieve Toast message but not able to achieve focus and error beside on radiogroup which is unchecked. **CustomAdapter** public class CustomAdapter extends BaseAdapter { Context context;

uncheck radiobutton/radiogroup on Button click - Android

我的未来我决定 提交于 2019-12-11 15:22:21
问题 I am using radiobuttons in my radiogroup and each radiogroup is generated dynamically. I want all radiogroup unchecked in more specific I want all radiobuttons in radiogroup should be unchecked when user click on clear button . I using radiogroup in my listview and generating each listview using a custom adapter. Here is my code: Mainactivity public class MainActivity extends AppCompatActivity { private ListView simpleListView; private CustomAdapter customAdapter; private String[] questions;

Which element do I need to modify to add padding between a drawable and its enclosed elements?

自古美人都是妖i 提交于 2019-12-11 08:52:41
问题 Based on what I learned here, I was able to add some "fences" around groupings of related widgets: But, as you can see, the second/lower box is crowding the first radio button text. Which element do I need to modify to add some space? Do I need to add something to the box itself, which lives in the drawable folder and is defined like this: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <stroke android:width=

ConstraintLayout, RadioGroup and two columns of RadioButton

允我心安 提交于 2019-12-11 05:25:32
问题 I have a ConstraintLayout as a root Layout and it's fine. However I now have a RadioGroup where I have to make two columns of RadioButtons within it. Since ConstraintLayout is about getting the rid of Nested Layouts, I thought it would be fine placing those RadioButtons in the RadioGroup and place them appropriately. Turns out having a ConstraintLayout as a Root layout, Containing the RadioGroup, doesn't seem to change anything. But maybe I'm wrong. How would you guys achieve having two rows

How to set radio button to checked when i click on list item

半世苍凉 提交于 2019-12-08 19:05:29
I am having a problem with my listview ( 2 textview and 1 radio button). The problem: My idea is that the user clicks on the item in the listview and the radio button gets checked automatically. I have been searching for a while, but I can't get the radio button to work. My XML <RadioButton android:id="@+id/rdBtn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="false" /> My Adapter r = (RadioButton) convertView.findViewById(R.id.rdBtn); r.setChecked(selectedPosition == position); r.setTag(position); r.setOnClickListener(new View.OnClickListener() {

RadioGroup retrieve is null

。_饼干妹妹 提交于 2019-12-08 11:43:02
问题 I try to retrieve my RADIOGROUP for check which Radio Button is checked. For this, I use this code in onCreate() : /** * @param savedInstanceState */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); radioGroup_LANGUE = (RadioGroup) findViewById(R.id.RadioGroup_LANGUE); radioGroup_MODE = (RadioGroup) findViewById(R.id.RGroup_ModeConnexion); ... } But I use the debug, and AndroidStudio tell me radioGroup_LANGUE is null. So I get NULLPOINTER

How to set radio button to checked when i click on list item

懵懂的女人 提交于 2019-12-08 06:24:24
问题 I am having a problem with my listview ( 2 textview and 1 radio button). The problem: My idea is that the user clicks on the item in the listview and the radio button gets checked automatically. I have been searching for a while, but I can't get the radio button to work. My XML <RadioButton android:id="@+id/rdBtn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="false" /> My Adapter r = (RadioButton) convertView.findViewById(R.id.rdBtn); r.setChecked

Checking RadioButton of RadioGroup in ListView checks other item button

旧巷老猫 提交于 2019-12-08 05:42:10
问题 here is adapter class..... public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder=null; Student temp = (Student) getItem(position); if (convertView == null) { convertView = mInflator.inflate(R.layout.item_class_student, null); holder = new ViewHolder(); holder.nameTextView = (TextView) convertView.findViewById(R.id.row_student_name); holder.classTextView = (TextView) convertView.findViewById(R.id.row_student_class); holder.rollNumberTextView =