2

There are two published applications both use the same method to write a file that is the basis for an in app profile. I would like to create a central point where the user can read their aggregated profile information. What is the directory I should be trying to access to get at these files to read them in my new app? Is this even possible or should I make these two apps use sqlite w/ a content provider? or some other method?

I've read the fos documentation but only certain methods provide a path while the one in question does not

I'm not really sure how to approach this. Thanks for the direction.

Here is the write method:

    public void write(Context ctx){

    try {

        FileOutputStream fos;
        fos = ctx.openFileOutput("profile", Context.MODE_WORLD_READABLE);
        ObjectOutputStream oos = new ObjectOutputStream(fos);

        oos.writeObject(profile);

        oos.close();
        fos.close();
    } catch (IOException e) {
        e.printStackTrace();
        Toast.makeText(ctx, "Error: Writing to file",
                Toast.LENGTH_SHORT).show();
    }
}
KDEx
  • 3,505
  • 4
  • 31
  • 39
  • Can you already create the file at all? You can save the file in a folder(which you can also create) on an external storage. This is basic usafe of the File object. Creating the file theres different ways of doing it. You could use sqlite. But should be doable without it. Otherwise, mention if you want it in internal storage or external – Joey Roosing Jun 14 '12 at 12:46
  • I would prefer internal, so that when the user changes their SD card they wont loose their information – KDEx Jun 14 '12 at 12:51
  • Try this; http://stackoverflow.com/questions/5745243/data-sharing-between-two-applications it sounds like what you need. – Joey Roosing Jun 14 '12 at 12:58

0 Answers0