Hello,

I have an app that can read and write txt files to the phones sdcard.
By using this code for reading files:

        @Override
        protected void onListItemClick(ListView l, View v, int position, long
id) {
                super.onListItemClick(l, v, position, id);
                mFileNameOpen = files.get(position);
                String st = null;
                mVector.clear();
                notepad.mNewEmpty = false;
                try {
                        File f = new 
File(Environment.getExternalStorageDirectory()+"/
notepad/"+mFileNameOpen);
                        FileInputStream fileIS = new FileInputStream(f);
                        BufferedReader in = new BufferedReader(new
InputStreamReader(fileIS));
                        do {
                                st = in.readLine();
                                mVector.add(st);
                        }while(st!=null);
                        in.close();

                        ...

                } catch (FileNotFoundException e) {
                        e.printStackTrace();
                } catch (IOException e) {
                        e.printStackTrace();
                }

        }

and this to write them:

              try {
                        File root = Environment.getExternalStorageDirectory();
                        File fileCheck = new File(root, "/notepad/" + 
fileNameSave +
saveExtension);
                    boolean exists = fileCheck.exists();
                    if (!exists) {
                        if (root.canWrite()) {
                                        File textFile = new File(root, 
"/notepad/" + fileNameSave +
saveExtension);
                                        FileWriter textWriter = new 
FileWriter(textFile);
                                        BufferedWriter out = new 
BufferedWriter(textWriter);
                                        out.write(SAVEAS);
                                        out.close();
                                        written = true;
                                } else {
                                        written = false;
                                }
                    } else {
                        written = true;
                        showMaybe = 1;
                        showDialog(DIALOG_SAVE_EXISTS);
                    }
                } catch (IOException e) {
                        Log.v(getString(R.string.app_name), e.getMessage());
                }

This has been working fine on my Tattoo and all the emulators I've
tried this on. But it does not seem to be working on moto droid. Is
there something different to consider with moto droid? Or have I
missed something in the manifest maybe?

Any suggestions?

-- 
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