Troquei meu codigo para
InputStream teste = getResources().openRawResource(R.raw.perguntas);
BufferedReader br = new BufferedReader(new InputStreamReader(teste));
TextView texto = (TextView) findViewById(R.id.textView1);
String message = br.toString();
texto.setText(message);
Mas o continua retornar a representação do objeto
java.io.BufferedReader@41cb3b10Em quinta-feira, 27 de fevereiro de 2014 14h36min41s UTC-3, Douglas Drumond escreveu:
Teste.toString retorna a representação do objeto, vc precisa chamar read ou readLine (talvez tenha que passar o input stream p um input stream Reader, estou do celular sem referências)
Androidから送信
On Feb 27, 2014 2:19 PM, "Vinny Valente" <irmaoca...@gmail.com> wrote:--Joguei meu arquivo txt em assets, mas ele retorna este valor android.content.res.AssetManager$AssetInputStream@ 41cb3a90 não retorna o q esta dentro do arquivo.Alguem sabe como ler esse arquivo?Segue codigo:AssetManager mngr = getAssets();try {InputStream teste = mngr.open("Files/perguntas.txt"); TextView texto = (TextView) findViewById(R.id.textView1);String message = teste.toString();texto.setText(message);} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}Em quinta-feira, 27 de fevereiro de 2014 13h20min41s UTC-3, Marcelo Alves escreveu:Sim, resolve, mas você acha que um usuário comum vai saber disso? Vão saber colocar \n pra quebrar linhas? Por isso a ideia de um formato mais "humano".
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-...@googlegroups.com .
For more options, visit https://groups.google.com/groups/opt_out .
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.






0 comentários:
Postar um comentário