Cómo mostrar varias líneas de datos de un archivo de texto en un diseño de tabla de Android

Coloque su archivo de texto en una carpeta sin procesar y luego en OnCreate func. escriba este código. Espero que responda su consulta

@Anular

public void onCreate (Bundle savedInstanceState) {

super.onCreate (savedInstanceState);

setContentView (R.layout.activity_quiz);

tratar {

PlayWithRawFiles ();

} catch (IOException e) {

Toast.makeText (getApplicationContext (),

“Problemas:” + e.getMessage (), Toast.LENGTH_LONG) .show ();

}

} // onCreate

public void PlayWithRawFiles () lanza IOException {

String str = “”;

StringBuffer buf = new StringBuffer ();

InputStream es = this.getResources (). OpenRawResource (R.raw.quiz);

BufferedReader reader = new BufferedReader (nuevo InputStreamReader (is));

if (is! = null) {

while ((str = reader.readLine ())! = null) {

buf.append (str + “\ n”);

}

}

está cerca();

TextView tv = (TextView) findViewById (R.id.tv1);

tv.setText (buf.toString ());

}}