title: How to get data from string buffer How do I get Values One By One In Each String That I Defined Below From StringBuffer
body: <p>I don't know what to do but I am having problem in getting values one by one from StringBuffer from the code that I did any suggestions are most welcome and thanks in advance :)</p>
  
  <pre><code>    String n="";
                  String f="";
                  String ma="";
                  String s1="";
                  String s2="";
                  String mc="";
                  String fc="";
                  String bc="";
                  String pc="";
                  String oc="";
                  String ad="";
                  String s="";
                  String d="";
                  String e="";
                  Cursor m= a.getData(userName);
                  StringBuffer sb= new StringBuffer();
                  if(m!=null&amp;&amp;m.getCount()&gt;0)
                  {while (m.moveToNext())
                  {
  
      //Here I am passing the stringbuffer values to ultimate string field//
  
  
           n= String.valueOf(sb.append(m.getString(m.getColumnIndex("Name"))));             
  
      f= String.valueOf(sb.append(m.getString(m.getColumnIndex("Fathername"))));
                      ma=String.valueOf(sb.append(m.getString(m.getColumnIndex("Mothername"))));
  
      s1= String.valueOf(sb.append(m.getString(m.getColumnIndex("Selfcontact1"))));
  
       s2= String.valueOf(sb.append(m.getString(m.getColumnIndex("Selfcontact2"))));
  
        mc= String.valueOf(sb.append(m.getString(m.getColumnIndex("Mothercontact"))));
  
         fc= String.valueOf(sb.append(m.getString(m.getColumnIndex("Fathercontact"))));
  
       bc= String.valueOf(sb.append(m.getString(m.getColumnIndex("Brothercontact"))));
  
       pc= String.valueOf(sb.append(m.getString(m.getColumnIndex("Policecontact"))));
  
       oc= String.valueOf(sb.append(m.getString(m.getColumnIndex("Othercontact"))));
  
       ad= String.valueOf(sb.append(m.getString(m.getColumnIndex("Address"))));
  
       s= String.valueOf(sb.append(m.getString(m.getColumnIndex("Sex"))));
  
        d= String.valueOf(sb.append(m.getString(m.getColumnIndex("Dob"))));
  
        e= String.valueOf(sb.append(m.getString(m.getColumnIndex("Email"))));
                   }
  
  
  //HEre I am getting the values //
  
  
             nametext.setText(n.toString());
          fnametext.setText(f.toString());
                      mnametext.setText(ma.toString());
             scontact1text.setText(s1.toString());
                      scontact2text.setText(s2.toString());
                      mcontacttext.setText(mc.toString());
                      fcontacttext.setText(fc.toString());
                      bcontacttext.setText(bc.toString());
                      pcontacttext.setText(pc.toString());
                      ocontacttext.setText(oc.toString());
                      addtext.setText(ad.toString());
                      sextext.setText(s.toString());
                      dobtext.setText(d.toString());
                      emailtext.setText(e.toString());
                  }
  </code></pre>