Answer the question
In order to leave comments, you need to log in
How to solve problem with deleting substring from file in JAVA?
In OnCreate
Update("studentsapp1pn.txt",(RadioGroup) findViewById(R.id.rasRgPn));
public void Update(String filename,RadioGroup rclv)
{
String TEXT="";
try {
// открываем поток для чтения
BufferedReader br = new BufferedReader(new InputStreamReader(
openFileInput(filename)));
String str = "";
// читаем содержимое
while ((str = br.readLine()) != null) {final RadioButton newRadioButton = new RadioButton(this);
newRadioButton.setText(str.toString());
newRadioButton.setId(200+NumItems);
newRadioButton.setButtonDrawable(null);
rclv.addView(newRadioButton);
NumItems++;
newRadioButton.setOnLongClickListener(new View.OnLongClickListener() {
public boolean onLongClick(View view) {
newRadioButton.setVisibility(View.GONE);
return false;
}
});
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question