Issue with reading file from internal memory
<p>I m using read &amp; write string to internal memory. My <strong>"WriteFavData"</strong> is working fine. But In <strong>"ReadFavData"</strong> is not working. Actually when i reach the line <strong>if(favFile.exists())</strong> in ReadFavData(..,..), it says file not found &amp; execute the else part. I have already check the emulator internal memory using command line shell access <strong>adb shell cat /data/data/com.android.mypackage/files/fav_data_channel</strong>, the file is there. Why is saying file is not present.? Any ideas....</p>

<pre><code>    public boolean ReadFavData(Context context, String channelName)
        {
            boolean isFileFound = false;
            FileInputStream fin ;
            StringBuffer strContent = new StringBuffer("");
            String fileName = FAV_FILE_NAME + "_" + channelName;
            File favFile = new File(fileName);
            int ch;
            if(favFile.exists())
            {
                isFileFound = true;
                try {
                    fin = context.openFileInput(FAV_FILE_NAME + "_" + channelName);
                    isFileFound = true;
                    while ((ch = fin.read()) != -1)
                        {
    strContent.append((char) ch);
    }

                    fin.close();                


                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }       
            }
            else 
            {
                Log.i(TAG, "not found");
            }

            return isFileFound;
        }



public boolean WriteFavData(Context context, String channelName)
        {
            String favStr;
            FileOutputStream fos ;
            JSONObject videos = new JSONObject();           
            videos.put("videos", favJsonArray);
            String favStr = videos.toJSONString(); //note.toString();
            String fileName = FAV_FILE_NAME + "_" + channelName;
            File f = new File(fileName);
            if(f.exists())
            {
                Log.i("Old FIle", "Found");
                f.delete();     
            }

            if(f.exists())
                Log.i("Still", "Exist");

            try {               
                    fos = context.openFileOutput(FAV_FILE_NAME + "_" + channelName, Context.MODE_PRIVATE);              
                fos.write(favStr.getBytes());
                fos.close();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }       
            return true;
        }
</code></pre>

<p>Actually, i debugged again &amp; track that on line <strong>if(file.exists())</strong>, the file is not present.. But if i comment this line &amp; read my file directly, i m able to read file successfully. Whats wrong with <strong>if(file.exists())</strong>?</p>
