THanks Charlie, and thanks to Mark, now I've a new problem, I'm very
sorry but I'm a "beginners" of Android , I'm not able to read a file!!
First of all I've found the file in the File explorer, but I can see
only the icon and can't open it ,it seems also tha the file Data.dat
is empty, as a matter of fact the size showed in the File Exolorer is
"0" .
Second ,what is the right way to read  file from an Android
application?
like this: ??
/******************************************/
Scanner s=new Scanner("Data.dat");
while (true) {
String l = s.nextLine(); }
/*****************************************/
Thanks a lot:)


On Jul 28, 3:44 pm, Charlie Collins <[email protected]> wrote:
> Window->Show View->Android->File Explorer
>
> Or you can use the DDMS file 
> explorer:http://developer.android.com/guide/developing/tools/ddms.html.
>
> Or you can use "adb shell" to connect and browse around manually (ls /
> data/data - for 
> example):http://developer.android.com/guide/developing/tools/adb.html.
>
> On Jul 27, 11:52 am, Lorenz <[email protected]> wrote:
>
>
>
> > Any idea?
>
> > On 27 Lug, 17:31, Lorenz <[email protected]> wrote:
>
> > > Sorry guys,
> > > but Ican'tfindthe folder /data..I use Eclipse and type: file->openFile 
> > > but i'm unable tofind/data/data/myfile..
>
> > > How can I do in eclipse tofindit?
>
> > > On 27 Lug, 17:19, Charlie Collins <[email protected]> wrote:
>
> > > > I didn't see Mark's reply before I posted mine, sorry.  As always,
> > > > Mark is on top of this group ;).
>
> > > > On Jul 27, 11:16 am, Charlie Collins <[email protected]>
> > > > wrote:
>
> > > > > Files created with Context.openFileOutput are in the "context" they
> > > > > were created in. 99% of the time you don't really care what that
> > > > > physical location is, you just retrieve the same file using the name
> > > > > with Context.openFileInput.
>
> > > > > If memory serves the actual physical location is /data/data/
> > > > > package_name/, or somewhere nearby. You can use the ADB or the Eclipse
> > > > > plugin file browser to browse around andfindthe exact location. The
> > > > > reason this is usually irrelevant though, is the permissions will only
> > > > > be set for the application that stored it, youcan'taccess it from
> > > > > other apps anyway (not if created with openFileOutput).
>
> > > > > On Jul 27, 10:51 am, Lorenz <[email protected]> wrote:
>
> > > > > > Hi,
> > > > > > I've a problem with method openFileOutput(), Ican'tfindthe file or
> > > > > > the directory where the file is stored..the code is:
> > > > > > import java.io.BufferedWriter;
> > > > > > import java.io.FileNotFoundException;
> > > > > > import java.io.FileOutputStream;
> > > > > > import java.io.IOException;
> > > > > > import java.io.OutputStreamWriter;
> > > > > > import java.io.PrintWriter;
>
> > > > > > import android.app.Activity;
> > > > > > import android.app.AlertDialog;
> > > > > > import android.content.Context;
> > > > > > import android.os.Bundle;
> > > > > > import java.io.*;
> > > > > > import java.net.*;
> > > > > > import java.util.NoSuchElementException;
> > > > > > import java.util.Scanner;
>
> > > > > > public class C extends Activity {
> > > > > >     /** Called when the activity is first created. */
> > > > > >         private PrintWriter savedpoint;
>
> > > > > >     @Override
> > > > > >     public void onCreate(Bundle savedInstanceState) {
> > > > > >         super.onCreate(savedInstanceState);
> > > > > >         setContentView(R.layout.main);
> > > > > >         try{
>
> > > > > >         savedpoint = new PrintWriter(openFileOutput
> > > > > > ("Data.dat",MODE_APPEND));
>
> > > > > >         for(int i=0;i<20;i++)
> > > > > >         {
> > > > > >                 savedpoint.println(-78.443221+"i"+" 
> > > > > > "+120.344423+"i");
>
> > > > > >         }
>
> > > > > >         }catch (FileNotFoundException e) {
> > > > > >                         e.printStackTrace();
> > > > > >                 }
> > > > > >     }
>
> > > > > > }
>
> > > > > > and the manifest is:
>
> > > > > > <?xml version="1.0" encoding="utf-8"?>
> > > > > > <manifest xmlns:android="http://schemas.android.com/apk/res/android";
> > > > > >       package="prova.client"
> > > > > >       android:versionCode="1"
> > > > > >       android:versionName="1.0">
> > > > > >     <application android:icon="@drawable/icon" 
> > > > > > android:label="@string/
> > > > > > app_name">
> > > > > >         <activity android:name=".C"
> > > > > >                   android:label="@string/app_name">
> > > > > >             <intent-filter>
> > > > > >                 <action android:name="android.intent.action.MAIN" />
> > > > > >                 <category
> > > > > > android:name="android.intent.category.LAUNCHER" />
> > > > > >             </intent-filter>
> > > > > >         </activity>
> > > > > >     </application>
> > > > > >     <uses-sdk android:minSdkVersion="3" />
> > > > > > </manifest>
>
> > > > > > Any idea?where can Ifindthe directory where is stored the file?
> > > > > > thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to