android - Unable to add text to dynamic radiobuttons -
i trying add dynamic radio buttons , text string array. able add radiobuttons of same array length of "application" text not displayed..any idea?
private string[] application = {"abc", "def", "ghi", "jkl"}; radiobutton[] rb = null; radiogroup = (radiogroup) mlinearview3.findviewbyid(r.id.myradiogroup); rb = new radiobutton[application.length]; for(int m = 0; m < application.length; m++) { rb[m] = new radiobutton(getapplicationcontext()); rb[m].settext(application[m]); rb[m].setid(m); radiogroup.addview(rb[m]); } mlinearscrollthird.addview(mlinearview3); layout.xml
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" android:orientation="vertical"> <radiogroup android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/text" android:id="@+id/myradiogroup" android:background="#fff" android:checkedbutton="@+id/sound"> </radiogroup> <view android:layout_width="match_parent" android:layout_height="1dp" android:background="@android:color/darker_gray"/> </linearlayout>
go link think understand have do
Comments
Post a Comment