android-developers
[Arriba] [Todas las Listas]

Re: [android-developers] Escribiendo para archivar problema

To: android-developers@xxxxxxxxxxxxxxxx
Subject: Re: [android-developers] Escribiendo para archivar problema
From: Mark Murphy <mmurphy@xxxxxxxxxxxxxxx>
Date: Sun, 30 Oct 2011 17:02:34 -0400
Delivery-date: Sun, 30 Oct 2011 17:03:15 -0400
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:mime-version:in-reply-to:references:from :date:message-id:subject:to:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type :content-transfer-encoding; bh=6qPG/7nqIPM35XUXes3M6n8YR649YQUTm7nbZUBHh4g=; b=VLNW7k4fuas1OijNSCESXr0GAaBySEObt8AuHMEIsZUjCPhEPuI/KQQmSt/iYiA3KR kx2subOCEeJ/UGsqGw+Wozh+JzHmVoyX9V/Ew1mc+RWj78AL7zsHFtiXeMMnteHW3j2n uAkgKm7p1xP9fi2EfA3Gb+LYcyqBAURSkk6Wk=
Envelope-to: traductor@xxxxxxxxxxx
In-reply-to: <9069664c-beab-41c1-a002-5df6003e1bb2@x20g2000vbl.googlegroups.com>
List-archive: <http://groups.google.com/group/android-developers?hl=en_US>
List-help: <http://groups.google.com/support/?hl=en_US>, <mailto:android-developers+help@googlegroups.com>
List-id: <android-developers.googlegroups.com>
List-post: <http://groups.google.com/group/android-developers/post?hl=en_US>, <mailto:android-developers@googlegroups.com>
List-subscribe: <http://groups.google.com/group/android-developers/subscribe?hl=en_US>, <mailto:android-developers+subscribe@googlegroups.com>
List-unsubscribe: <http://groups.google.com/group/android-developers/subscribe?hl=en_US>, <mailto:android-developers+unsubscribe@googlegroups.com>
Mailing-list: list android-developers@xxxxxxxxxxxxxxxx; contact android-developers+owners@xxxxxxxxxxxxxxxx
References: <9069664c-beab-41c1-a002-5df6003e1bb2@x20g2000vbl.googlegroups.com>
Reply-to: android-developers@xxxxxxxxxxxxxxxx
Sender: android-developers@xxxxxxxxxxxxxxxx
Necesitas a *append al archivo. Eres *overwriting el archivo. Esto es
estándar *Java I/O y tiene nada en particular de hacer con *Android.

*http://*exampledepot.*com/*egs/*java.*io/*AppendToFile.*html

En Sol, *Oct 30, 2011 en 4:54 PM, *leigh8347 <*leigh8347@*xxxxxxx> escribió:
> hola
>
> puede cualquiera ayuda?
>
> En mi *app *im intentando hacer el siguiente - Salvar 2 entradas de usuario a un .*txt
> Archivo y salvarlo, entonces ser capaz de introducir 2 más entradas y salvar otra vez
> y repetir mucho tiempo.
>
> Tan lejos mi código crea un archivo, escribe las primeras 2 entradas y salva.
> Pero cuándo *i verbcj
You need to append to the file. You are overwriting the file. This is
standard Java I/O and has nothing in particular to do with Android.

http://exampledepot.com/egs/java.io/AppendToFile.html

On Sun, Oct 30, 2011 at 4:54 PM, leigh8347 <leigh8347@xxxxxxx> wrote:
> hello
>
> can anyone help?
>
> on my app im trying to do the following - Save 2 user inputs to a .txt
> file and save it, then be able to enter 2 more inputs and save again
> and repeat many times.
>
> so far my code creates a file, writes the first 2 inputs and saves.
> but when i try saving another 2 it just replaces the first. im quite
> confused.
>
> here is what i have
>
>        txtData = (EditText) findViewById(R.id.input1);
>        txtData2 = (EditText) findViewById(R.id.input2);
>
>        btnWriteSDFile = (Button) findViewById(R.id.save);
>        btnWriteSDFile.setOnClickListener(new OnClickListener() {
>
>        public void onClick(View v) {
>                // write on SD card file data in the text box
>                try {
>                        File myFile = new File(Environment.getExternalStorageDirectory(),
> "parkrun_barcode.txt");
>                        myFile.createNewFile();
>                        FileOutputStream fOut = new FileOutputStream(myFile);
>                        OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);
>
>                        myOutWriter.append(txtData.getText() + ", " + txtData2.getText());
>                        myOutWriter.close();
>                        fOut.close();
>                        Toast.makeText(getBaseContext(),
>                                        "Saved'",
>                                        Toast.LENGTH_SHORT).show();
>                } catch (Exception e) {
>                        Toast.makeText(getBaseContext(), e.getMessage(),
>                                        Toast.LENGTH_SHORT).show();
>                }
>
>                        txtData.setText("");
>                        txtData2.setText("");
>
>
>        }
>        });
>
>        }
>
> }
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@xxxxxxxxxxxxxxxx
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@xxxxxxxxxxxxxxxx
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in NYC: http://marakana.com/training/android/

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
android-developers+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

<Anterior por Tema] Tema Actual [Siguiente por Tema>