title: How to retreive data from mysql database in RecyclerView into RadioButton
body: <p>Im creating a <code>RecyclerView</code> using jdbc connection and mysql database. Inside the <code>RecyclerView</code> I am uploading data from my database into one <code>TextView</code> and three radioButtons . Everything works just fine, but my problem is that it only shows the first <code>RadioButton</code> and there is nothing in the second and third one. </p>
  
  <p>Here is my java code :</p>
  
  <pre><code>public class GererVoteInvite extends AppCompatActivity {
      private ArrayList&lt;VoteItem&gt; itemArrayList;  //List items Array
      private MyAppAdapter myAppAdapter; //Array Adapter
      private RecyclerView recyclerView; //RecyclerView
      private RecyclerView.LayoutManager mLayoutManager;
      private boolean success = false; // boolean
  
      private static final String DB_URL = "jdbc:mysql://10.0.2.2/mvoting_db_1.0.0.0";
      //    private static final String DB_URL = "jdbc:mysql://172.16.24.25/mvoting_db_1.0.0.0"; //"jdbc:mysql://DATABASE_IP/DATABASE_NAME";
      private static final String USER = "mootaz";
      private static final String PASS = "mootaz";
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_gerer_vote_invite);
  
          recyclerView = (RecyclerView) findViewById(R.id.recyclerView); //REcyclerview Declaration
          recyclerView.setHasFixedSize(true);
          // use a linear layout manager
          mLayoutManager = new LinearLayoutManager(this);
          recyclerView.setLayoutManager(mLayoutManager);
  
          itemArrayList = new ArrayList&lt;VoteItem&gt;(); // Arraylist Initialization
  
          // Calling Async Task
          SyncData orderData = new SyncData();
          orderData.execute("");
      }
  
      // Async Task has three overrided methods,
      private class SyncData extends AsyncTask&lt;String, String, String&gt; {
          String msg = "Internet/DB_Credentials/Windows_FireWall_TurnOn Error, See Android Monitor in the bottom For details!";
          ProgressDialog progress;
  
          //Starts the progress dailog
          @Override
          protected void onPreExecute() {
              progress = ProgressDialog.show(GererVoteInvite.this, "Synchronising",
                      "RecyclerView Loading! Please Wait...", true);
          }
  
          // Connect to the database, write query and add items to array list
          @Override
          protected String doInBackground(String... strings) {
              try {
                  Class.forName("com.mysql.jdbc.Driver");
  
                  Connection conn = DriverManager.getConnection(DB_URL, USER, PASS); //Connection Object
  
                  if (conn == null) {
                      success = false;
                  } else {
                      // Change below query according to your own database.
                      String query = "SELECT lib_probleme , lib_solution_1 , lib_solution_2 , lib_solution_3  FROM reunion JOIN probleme JOIN solution WHERE reunion.id_reunion=probleme.id_reunion and probleme.id_probleme=solution.id_probleme ;";
                      Statement stmt = conn.createStatement();
                      java.sql.ResultSet rs = stmt.executeQuery(query);
  
                      // if resultset not null, I add items to itemArraylist using class created
                      if (rs != null) {
                          while (rs.next()) {
                              try {
                                  itemArrayList.add(new VoteItem(rs.getString("lib_probleme"), rs.getString("lib_solution_1"), rs.getString("lib_solution_2"), rs.getString("lib_solution_3")));
                              } catch (Exception ex) {
                                  ex.printStackTrace();
                              }
                          }
                          msg = "Found";
                          success = true;
                      } else {
                          msg = "No Data found!";
                          success = false;
                      }
                  }
              } catch (Exception e) {
                  e.printStackTrace();
                  Writer writer = new StringWriter();
                  e.printStackTrace(new PrintWriter(writer));
                  msg = writer.toString();
                  success = false;
              }
              return msg;
          }
  
          // disimissing progress dialoge, showing error and setting up my gridview
          @Override
          protected void onPostExecute(String msg) {
              progress.dismiss();
              Toast.makeText(GererVoteInvite.this, msg + "", Toast.LENGTH_LONG).show();
              if (success == false) {
              } else {
                  try {
                      myAppAdapter = new MyAppAdapter(itemArrayList, GererVoteInvite.this);
                      recyclerView.setAdapter(myAppAdapter);
                  } catch (Exception ex) {
  
                  }
  
              }
          }
      }
  
      public class MyAppAdapter extends RecyclerView.Adapter&lt;MyAppAdapter.ViewHolder&gt; {
          private List&lt;VoteItem&gt; values;
          public Context context;
  
          public class ViewHolder extends RecyclerView.ViewHolder {
  
              public TextView txtProbleme;
              public RadioGroup group;
              public RadioButton txtSol1;
              public RadioButton txtSol2;
              public RadioButton txtSol3;
              public View layout;
  
              public ViewHolder(View v) {
                  super(v);
                  layout = v;
                  group = (RadioGroup) v.findViewById(R.id.radio_group);
                  txtProbleme = (TextView) v.findViewById(R.id.tv_probleme);
                  txtSol1 = (RadioButton) v.findViewById(R.id.rb_1);
                  txtSol2 = (RadioButton) v.findViewById(R.id.rb_2);
                  txtSol3 = (RadioButton) v.findViewById(R.id.rb_3);
              }
          }
  
          // Constructor
          public MyAppAdapter(List&lt;VoteItem&gt; myDataset, Context context) {
              values = myDataset;
              this.context = context;
          }
  
          // Create new views (invoked by the layout manager) and inflates
          @Override
          public MyAppAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
              // create a new view
              LayoutInflater inflater = LayoutInflater.from(parent.getContext());
              View v = inflater.inflate(R.layout.vote_view, parent, false);
              ViewHolder vh = new ViewHolder(v);
              return vh;
          }
  
          // Binding items to the view
          @Override
          public void onBindViewHolder(ViewHolder holder, final int position) {
  
              final VoteItem voteItem = values.get(position);
              holder.txtProbleme.setText(voteItem.getProbleme());
              holder.group.setTag(position);
              holder.txtSol1.setText(voteItem.getSol1());
              holder.txtSol2.setText(voteItem.getSol2());
              holder.txtSol3.setText(voteItem.getSol3());
  
          }
  
          // get item count returns the list item count
          @Override
          public int getItemCount() {
              return values.size();
          }
      }
  }
  </code></pre>
  
  <p>And here is my <code>layout.xml</code> that containt the item for the <code>RecyclerView</code></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:card_view="http://schemas.android.com/apk/res-auto"
      android:id="@+id/ac"
      android:layout_width="match_parent"
      android:layout_height="205dp"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:padding="5dp"&gt;
  
      &lt;android.support.v7.widget.CardView
          android:id="@+id/vote_card"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_marginLeft="7dp"
          android:layout_marginRight="7dp"
          android:layout_marginTop="10dp"
          card_view:cardBackgroundColor="@color/white"
          card_view:cardCornerRadius="10dp"
          card_view:cardElevation="5dp"&gt;
  
  
          &lt;TextView
              android:id="@+id/tv_probleme"
              android:layout_width="fill_parent"
              android:layout_height="40dp"
              android:layout_marginTop="30dp"
              android:paddingLeft="15dp"
              android:paddingRight="15dp"
              android:text="Probleme :"
              android:textAppearance="?android:attr/textAppearanceLarge"
              android:textSize="16dp" /&gt;
  
          &lt;RadioGroup
              android:id="@+id/radio_group"
              android:layout_width="match_parent"
              android:layout_height="match_parent"&gt;
  
              &lt;RadioButton
                  android:id="@+id/rb_1"
                  android:layout_width="fill_parent"
                  android:layout_height="40dp"
                  android:layout_marginTop="60dp"
                  android:text="Solution 1" /&gt;
  
              &lt;RadioButton
                  android:id="@+id/rb_2"
                  android:layout_width="fill_parent"
                  android:layout_height="40dp"
                  android:text="Solution 2" /&gt;
  
              &lt;RadioButton
                  android:id="@+id/rb_3"
                  android:layout_width="fill_parent"
                  android:layout_height="40dp"
                  android:text="Solution 3" /&gt;
          &lt;/RadioGroup&gt;
      &lt;/android.support.v7.widget.CardView&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Here is the screenshot of my app</p>
  
  <p><a href="https://i.stack.imgur.com/CXCf6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CXCf6.png" alt="[1]: https://i.stack.imgur.com/p7tIl.png"></a></p>