Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] Leitura de TXT ou XML

é uma topologia meio maluca isso q vc falou, mas se vc for usar mesmo, aconselho a usar xml e a biblioteca simpleXML, bem simples!


--
Carlos Eduardo Simões Pelegrin


Em 25 de março de 2014 13:59, Carlos Alberto Pinto <caneto@gmail.com> escreveu:
Segue um exemplo basico, lendo da pasta 'assets', uso direto, ele le o arquivo e uso a função abaixo para converter e trasformar em string.

Espero que Ajude,

Carlos Alberto
----------------------------------------------------------------------------------

  AssetManager assetManager = getAssets();

 documento = "arquivo.txt";

 InputStream inputStream = null;
 try {
       inputStream = assetManager.open(+this.documento);
 } catch (IOException e) {
               Log.e(TAG, e.getMessage());
 }
 String s = readTextFile(inputStream);
 
 toast(s);



/**
         * This method reads simple text file
      * @param inputStream
      * @return data from file
    */
    private String readTextFile(InputStream inputStream) {
            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
            byte buf[] = new byte[1024];
            int len;
            try
            {
                while ((len = inputStream.read(buf)) != -1)
                {
                    outputStream.write(buf, 0, len);
                }
                outputStream.close();
                inputStream.close();
            } catch (IOException e) {
            }
            return outputStream.toString();
    }       




Em 25 de março de 2014 13:46, Claudio <listas.arquivo@gmail.com> escreveu:

Marcos, 

Quanto ao txt, procure no google por : android escrita leitura arquivo txt

Vai aparecer vários artigos, veja o que melhor lhe agrade, tenta implementa-lo e uma vez funcionando, ENTENDA-O e vá alterando conforme a sua necessidade.

Cláudio.


Em 25 de março de 2014 13:30, Marcos Ferreira <maferreira.f2@gmail.com> escreveu:

Pessoal

Sou iniciante em programação para mobile. Preciso criar uma aplicação simples que vá ler um arquivo texto de 15 em 15 segundos. Este arquivo poderá ser transformado em padrão XML se for necessário. Alguém teria algum tutorial/apostila onde tenha um passo a passo para fazer o que preciso ou que possa começar a aprender a programar.

A quantidade de linhas do arquivo é variável e são muitas informações em cada linha, portanto poderei rolar na horizontal quanto vertical para visualizar todas as informações, mas terei um cabeçalho fixo com o nome das colunas.

Alguém aqui programa também para iPhone/iPad? O desenvolvimento para as plataformas Mac e Android é parecida?


Att

Marcos Ferreira

--
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/d/optout.

--
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/d/optout.

--
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/d/optout.

--
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/d/optout.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário