Peace on you
to set dynamically created Radio buttons into a RadioGroupfor I find this solution
http://androiddesk.wordpress.com/2012/08/05/creating-dynamic-views-in-android/
and to parce the csv file I've used this fonction
private String[] loadArrayFromFileName(){
String[] liste=null;
String[] liste2=null;
String liste3=null;
int s=0;
try {
// Get input stream and Buffered Reader for our data file.
InputStream is = FocusTow.this.getAssets().open("Test.csv");
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String line;
//Read each line
while ((line = reader.readLine()) != null) {
liste2=line.split("\n");
for(int i=0; i< liste2.length;i++){
if(s==0) {
liste3=liste2[i];
s=1;
}
else liste3=liste3+","+liste2[i];
}
}
liste=liste3.split(",");
//Read each line
} catch (IOException e) {
e.printStackTrace();
}
return liste;
}
and this is the code of my button listener
mybutton.setOnClickListener(new OnClickListener() {
int j=0;
final String[] liste=loadArrayFromFileName();
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
for( j=0;j<liste.length/2;j++){
RadioButton radiobutton=new RadioButton(getApplicationContext());
radiobutton.setText(liste[j*2+1]);
radioGroup.addView(radiobutton);
}
}
});
I hope this help u,
Thanks.