I don't know if the source for the android tools has been made
available or will be made available, but that would be something to
watch for in the future if you needed some way to write to your
computers hard drive. You could also try to use the sdcard. There
might be a way to mount it in your computer. That way, you could write
to the sdcard from your client code, then access it in your computer.

/data/data/<your.app.namespace>/files/out.txt is on the emulator file
system. You can log in with "adb shell" or you can copy the file from
the emulator with adb pull.

So with your http post, you were using the actual ip address of your
computer in the url? That should work.

On Apr 1, 10:48 pm, yizhao <[EMAIL PROTECTED]> wrote:
> I can't write to the C: drive?!  That sucks.  Are there any other
> alternatives?  I need the Android app to relay info to the outside
> world (app write data that outside programs consume).  These are the
> two ways I came up with : ).
>
> When I said I couldn't find this file, I meant the computer file
> system.  How do I access /data/data/<your.app.namespace>/files/
> out.txt?  Can an independent java program be able to read from this
> file?
>
> As for the http post, from an independent client, it works (I had to
> of course change 0.0.2.2 to localhost).  The post hits a webapp
> implemented in Web Works.  I have this code sitting inside the
> onCreate() method of an Activity.  It doesn't give any on screen
> exceptions.  Just no result on the server side.
>
> Thanks again,
> Yi
>
> On Apr 2, 1:24 am, "Dan U." <[EMAIL PROTECTED]> wrote:
>
> > ok, here's my advice:
>
> > - You won't be able to write to your c: drive afaik.
> > - You can't find the file on the file system? Do you mean your
> > computers file system or the emulators file system? It should be on
> > the emulator in /data/data/<your.app.namespace>/files/out.txt.
> > - I don't think there would be a permissions problem for either the
> > file or http examples you gave.
> > - Your http post code looks ok at first glance. Are you getting any
> > exceptions with it?
>
> > Why do you need to write something to C: anyway? Are you working on
> > some kind of development tool?
>
> > On Apr 1, 9:54 pm, yizhao <[EMAIL PROTECTED]> wrote:
>
> > > Hi everyone,
>
> > > I have an app that needs to write to a file that is accessible from
> > > programs outside of Android.  The snippet of code is as follows:
>
> > >             OutputStreamWriter osw = new
> > > OutputStreamWriter( openFileOutput( "out.txt",
> > > MODE_WORLD_READABLE ) );
> > >             osw.write( "picture taken: " + picId );
> > >             osw.flush();
> > >             osw.close();
>
> > > Android doesn't allow me to write to the outside, for example the C:
> > > drive and I'm not able to find this file anywhere on the file system.
> > > I'm guessing its some kind of permissions problem.  I would like to be
> > > able to write to anywhere on the file system I want.  Is that
> > > possible?
>
> > > Also, since what I tried above didn't work, I also tried writing a
> > > Http Post and posting the info to a webapp.  This code works
> > > independently but when put inside an Activitie's onCreate() method, it
> > > doesn't work.  Again, I'm guessing it has to do with permissions:
>
> > >             String data =
> > > URLEncoder.encode( "signinUserAccount.userName", "UTF-8" )  + "=" +
> > > URLEncoder.encode("a", "UTF-8");
> > >             data += "&" +
> > > URLEncoder.encode("signinUserAccount.password", "UTF-8") + "=" +
> > > URLEncoder.encode("b", "UTF-8");
>
> > >             URL url = new URL("http://10.0.2.2:8080/GoogleCamAF/
> > > userAccountView.action");
> > >             URLConnection conn = url.openConnection();
> > >             conn.setDoOutput(true);
> > >             OutputStreamWriter wr = new
> > > OutputStreamWriter(conn.getOutputStream());
> > >             wr.write(data);
> > >             wr.flush();
>
> > > Any advice would be greatly appreciated!
>
> > > Yi
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to