does the below permission help? android.permission.WRITE_EXTERNAL_STORAGE On Jan 5, 9:54 am, Arun <achoudhary2...@gmail.com> wrote: > Hi , > > I am trying to create a file in android framework using the following > snippet of code :- > > public void CreateMyFile() > { > try { > String destination = "/data/hellothere.txt"; > > File fileCon= new File(destination); > if( ! fileCon.exists() ){ > fileCon.createNewFile(); > }} > > catch (IOException ioe) { > ioe.printStackTrace();} > > //FilePermission fp=new FilePermission(destination,"write"); > } > > When i compile this on sdk and execute it, everythng works fine and > file got created in the /data path with the hellothere.txt name. > But when i compile it in the source code and execute this on a android > filesystem on emulator and real hardware, the file is not getting > created and I am getting teh following error in logcat :- > > I/ActivityManager( 54): Start proc file.app for activity > file.app/.fileop: pid=632 uid=10043 gids={1015} > W/System.err( 632): java.io.IOException: Parent directory of file is > not writable: /data/hellothere.txt > W/System.err( 632): at java.io.File.createNewFile(File.java:1263) > W/System.err( 632): at file.app.fileop.onCreate(fileop.java:44) > W/System.err( 632): at > android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: > 1047) > W/System.err( 632): at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > 2431) > W/System.err( 632): at android.app.ActivityThread.handleLaunchActivity > (ActivityThread.java:2484) > W/System.err( 632): at android.app.ActivityThread.access$2200 > (ActivityThread.java:119) > W/System.err( 632): at android.app.ActivityThread$H.handleMessage > (ActivityThread.java:1835) > W/System.err( 632): at android.os.Handler.dispatchMessage > (Handler.java:99) > W/System.err( 632): at android.os.Looper.loop(Looper.java:123) > W/System.err( 632): at android.app.ActivityThread.main > (ActivityThread.java:4325) > W/System.err( 632): at java.lang.reflect.Method.invokeNative(Native > Method) > W/System.err( 632): at java.lang.reflect.Method.invoke(Method.java: > 521) > W/System.err( 632): at com.android.internal.os.ZygoteInit > $MethodAndArgsCaller.run(ZygoteInit.java:860) > W/System.err( 632): at com.android.internal.os.ZygoteInit.main > (ZygoteInit.java:618) > W/System.err( 632): at dalvik.system.NativeStart.main(Native Method) > I/ActivityManager( 54): Displayed activity file.app/.fileop: 5196 ms > (total 5196 ms) > > Please someone help me in this regard
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en