[android-beginners] Re: Please help in creating simple text file

2009-08-25 Thread nitin

I'm setting these permissions, but I am not storing file in SD Card by
in data/files/ folder:

uses-permission
android:name=android.permission.ACCESS_COARSE_LOCATION/uses-
permission
uses-permission
android:name=android.permission.ACCESS_FINE_LOCATION/uses-
permission
uses-permission
android:name=android.permission.ACCESS_LOCATION_EXTRA_COMMANDS/
uses-permission
uses-permission
android:name=android.permission.ACCESS_MOCK_LOCATION/uses-
permission
uses-permission
android:name=android.permission.CONTROL_LOCATION_UPDATES/uses-
permission
uses-permission android:name=android.permission.INTERNET/uses-
permission

On Aug 24, 7:27 pm, Donn Felker donnfel...@gmail.com wrote:
 Are you setting the SDCard permission properly in the manifest?





 On Mon, Aug 24, 2009 at 7:22 AM, nitin ni...@infocratsweb.com wrote:

  though I was using 'this' as context in onCreate event. I ran the same
  code after removing 'Context' as parameter, still same result. At last
  I uninstalled the application from Emulator and restarted
  everythingit worked with the same code :) Thanks for your
  valuable timebut I am still thinking does Emulator not refresh
  things properly?

  On Aug 22, 2:46 pm, Mark Murphy mmur...@commonsware.com wrote:
   nitin wrote:
when i tried after changing the code like:
catch (IOException ioe) {
return ioe.toString();
}

Giving error:
java.io.FileNotFoundException:
/data/data/hello.world/files/test.txt

online samples are giving the same code...am i missing some
setting/permission? pls help

   Where are you getting the Context from? If it is your Activity instance,
   this code should work. If you are somehow creating your own Context
   object, then that might be the source of your problem -- use a Context
   given to you by Android, such as an Activity or Service object.

   --
   Mark Murphy (a Commons Guy)http://commonsware.com|
 http://twitter.com/commonsguy

   Android App Developer Training:http://commonsware.com/training.html

 --
 Donnhttp://blog.donnfelker.com/- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-beginners] Re: Please help in creating simple text file

2009-08-24 Thread nitin

though I was using 'this' as context in onCreate event. I ran the same
code after removing 'Context' as parameter, still same result. At last
I uninstalled the application from Emulator and restarted
everythingit worked with the same code :) Thanks for your
valuable timebut I am still thinking does Emulator not refresh
things properly?

On Aug 22, 2:46 pm, Mark Murphy mmur...@commonsware.com wrote:
 nitin wrote:
  when i tried after changing the code like:
  catch (IOException ioe) {
  return ioe.toString();
  }

  Giving error:
  java.io.FileNotFoundException:
  /data/data/hello.world/files/test.txt

  online samples are giving the same code...am i missing some
  setting/permission? pls help

 Where are you getting the Context from? If it is your Activity instance,
 this code should work. If you are somehow creating your own Context
 object, then that might be the source of your problem -- use a Context
 given to you by Android, such as an Activity or Service object.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Android App Developer Training:http://commonsware.com/training.html
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-beginners] Re: Please help in creating simple text file

2009-08-24 Thread Donn Felker
Are you setting the SDCard permission properly in the manifest?


On Mon, Aug 24, 2009 at 7:22 AM, nitin ni...@infocratsweb.com wrote:


 though I was using 'this' as context in onCreate event. I ran the same
 code after removing 'Context' as parameter, still same result. At last
 I uninstalled the application from Emulator and restarted
 everythingit worked with the same code :) Thanks for your
 valuable timebut I am still thinking does Emulator not refresh
 things properly?

 On Aug 22, 2:46 pm, Mark Murphy mmur...@commonsware.com wrote:
  nitin wrote:
   when i tried after changing the code like:
   catch (IOException ioe) {
   return ioe.toString();
   }
 
   Giving error:
   java.io.FileNotFoundException:
   /data/data/hello.world/files/test.txt
 
   online samples are giving the same code...am i missing some
   setting/permission? pls help
 
  Where are you getting the Context from? If it is your Activity instance,
  this code should work. If you are somehow creating your own Context
  object, then that might be the source of your problem -- use a Context
  given to you by Android, such as an Activity or Service object.
 
  --
  Mark Murphy (a Commons Guy)http://commonsware.com|
 http://twitter.com/commonsguy
 
  Android App Developer Training:http://commonsware.com/training.html
 



-- 
Donn
http://blog.donnfelker.com/

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



[android-beginners] Re: Please help in creating simple text file

2009-08-22 Thread nitin

when i tried after changing the code like:
catch (IOException ioe) {
return ioe.toString();
}

Giving error:
java.io.FileNotFoundException:
/data/data/hello.world/files/test.txt

online samples are giving the same code...am i missing some
setting/permission? pls help


On Aug 21, 6:30 pm, Mark Murphy mmur...@commonsware.com wrote:
 nitin wrote:
  thanks for quick response, I am new to android and self learner. how
  to see the adb logcat or in Eclipse.

 http://developer.android.com/guide/developing/tools/ddms.htmlhttp://developer.android.com/guide/developing/tools/adb.html

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Android App Developer Training:http://commonsware.com/training.html
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-beginners] Re: Please help in creating simple text file

2009-08-22 Thread Mark Murphy

nitin wrote:
 when i tried after changing the code like:
 catch (IOException ioe) {
 return ioe.toString();
 }
 
 Giving error:
 java.io.FileNotFoundException:
 /data/data/hello.world/files/test.txt
 
 online samples are giving the same code...am i missing some
 setting/permission? pls help

Where are you getting the Context from? If it is your Activity instance,
this code should work. If you are somehow creating your own Context
object, then that might be the source of your problem -- use a Context
given to you by Android, such as an Activity or Service object.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android App Developer Training: http://commonsware.com/training.html

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



[android-beginners] Re: Please help in creating simple text file

2009-08-21 Thread Mark Murphy

nitin wrote:
 hello,
 
 I want to create a simple text file in data/data/com.my.package/files/
 test.txt. My code is as follows:
 
 private String CreateFile(Context context){
   try{
   FileOutputStream fOut = context.openFileOutput
 (test.txt,MODE_WORLD_WRITEABLE);
   fOut.close();
   return 1;
   }
   catch(Exception e){
   return e.getMessage();
   }
 }
 
 I tried MODE_WORLD_READABLE also, but still gives error like:
 data/data/com.my.package/files/test.txt

That is not an error.

Look at your Java stack trace to find the error. The Java stack trace
can be obtained through adb logcat, DDMS, or the DDMS perspective in
Eclipse.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Need Android talent? Ask on HADO! http://wiki.andmob.org/hado

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



[android-beginners] Re: Please help in creating simple text file

2009-08-21 Thread nitin

hello sir,

thanks for quick response, I am new to android and self learner. how
to see the adb logcat or in Eclipse.
Is there something wrong in above code or some setting is required?
please help, sample code will be useful.

Thanks


On Aug 21, 3:09 pm, Mark Murphy mmur...@commonsware.com wrote:
 nitin wrote:
  hello,

  I want to create a simple text file in data/data/com.my.package/files/
  test.txt. My code is as follows:

  private String CreateFile(Context context){
             try{
                     FileOutputStream fOut = context.openFileOutput
  (test.txt,MODE_WORLD_WRITEABLE);
                     fOut.close();
                     return 1;
             }
             catch(Exception e){
                     return e.getMessage();
             }
      }

  I tried MODE_WORLD_READABLE also, but still gives error like:
  data/data/com.my.package/files/test.txt

 That is not an error.

 Look at your Java stack trace to find the error. The Java stack trace
 can be obtained through adb logcat, DDMS, or the DDMS perspective in
 Eclipse.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Need Android talent? Ask on HADO!http://wiki.andmob.org/hado- Hide quoted 
 text -

 - Show quoted text -
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-beginners] Re: Please help in creating simple text file

2009-08-21 Thread Mark Murphy

nitin wrote:
 thanks for quick response, I am new to android and self learner. how
 to see the adb logcat or in Eclipse.

http://developer.android.com/guide/developing/tools/ddms.html
http://developer.android.com/guide/developing/tools/adb.html

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android App Developer Training: http://commonsware.com/training.html

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