I eventually solved the problem with help of following dicussion http://www.anddev.org/viewtopic.php?p=25297#25297
my solution is:- public void CopyfiletoMemory(String filename){ FileOutputStream fos; DataOutputStream out; try{ FileInputStream in = new FileInputStream("/ sdcard/"+filename); boolean success = new File("/data/data/com.example.test2/ data").mkdir(); if (!success) System.out.println( "no success"); File file = new File("/data/data/com.example.test2/ data/"+filename); file.createNewFile(); if(!file.exists()){ file.createNewFile(); System.out.println( "File created..."); } fos = new FileOutputStream(file); out=new DataOutputStream(fos); // Transfer bytes from in to out byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } out.flush(); in.close(); out.close(); listfiles(); System.out.println("File Copied"); } catch (Exception e){ System.err.println("File input error"); } } private void listfiles(){ FilenameFilter fil=null; String destination = "/data/data/com.example.test2/data/"; File fileCon[] = new File(destination).listFiles(fil); for (int n=0;n<fileCon.length;n++) System.out.println("File "+fileCon[n]); } public void Openfile(String filename){ try { listfiles(); fstream = new RandomAccessFile("/data/data/ com.example.test2/data/"+filename,"rw"); ...... Hope this helps other newbies who can't figure out file creation. Steve --~--~---------~--~----~------------~-------~--~----~ 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 android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---