Good afternoon community, I wanted to ask the question, it turns out that I try to read a text file from a fragment but when I open it in the application I jump that the application stopped working, so I wanted to know if they could give me a hand .
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view;
view= inflater.inflate(R.layout.fragment_vocabulary,container);
TextView voc=(TextView) view.findViewById(R.id.vocabulario);
try {
InputStream archivo=getResources().openRawResource(R.raw.leccion10);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(archivo));
StringBuilder stringBuilder = new StringBuilder();
String linea;
while((linea =bufferedReader.readLine())!= null){
stringBuilder.append(linea).append("\n");
}
voc.setText(stringBuilder);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return view;
}
Try to find the solution but I'm running out of ideas, I hope your help, thanks in advance.