[android-developers] Re: getExternalStorageDirectory() on NEXUS S

2011-01-29 Thread Tabman
It's forced into the built-in space that will get picked up by the
Android media scanner when it indexes EXTERNAL_CONTENT_URI.

btw I don't think the media scanner picks it up. The media scanner
would need to be explicitly told to look at '/mnt/emmc'

On Jan 4, 12:45 pm, Tabman tabishfay...@gmail.com wrote:
 Thanks Doug,

 Your reply is very helpful, you also replied to another post of mine
 so thanks again :)

 On Dec 20 2010, 1:51 am, Doug beafd...@gmail.com wrote:







  On Dec 19, 2:14 pm, Tabman tabishfay...@gmail.com wrote:

   I have a question related to this. How many phones are out there with this
   type of behavior ? I want to access Camera Photos/Videos on a phone and 
   for
   that I've used EXTERNAL_CONTENT_URI but it seems that approach would fail 
   on
   a phone likeDroidIncredible. How should I design my app such that it is
   able to get camera data from any android phone ?

  It will fail on theDroidIncrediblebecause they didn't wire up that
  URI to point to the external storage mounted at, I think, /emmc.
  That's fragmentation for you.  (I think they did it wrong.)  But at
  least their camera app doesn't put content on the sdcard.  It's forced
  into the built-in space that will get picked up by the Android media
  scanner when it indexes EXTERNAL_CONTENT_URI.

  However, it works on Galaxy S devices because its built-in external
  space is wired to that URI --AND-- if you do have a sdcard in the
  device, it will mount THAT filesystem underneath the internal storage
  space.  So if the internal storage space was at /mnt/sdcard, your
  additional sdcard would be at /mnt/sdcard/external_sd.  And when the
  Android media scanner runs to index media referenced by
  EXTERNAL_CONTENT_URI, it will scan all of /mnt/sdcard, including the
  sdcard.  So they're doing it in a more compatible way that lets you
  get at the media on the user's sdcard in addition to the built-in
  space.

  I don't know what the Nexus S or HTC Hero do.  I also don't know what
  this Picasa Tool Pro does.  Maybe it doesn't query against the Android
  content providers for media and does its own thing instead.

  Doug

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


[android-developers] Re: getExternalStorageDirectory()

2011-01-16 Thread Bob Kerns
Actually, use:

File pathDir = Environment.getExternalStorageDirectory();

That is, don't use toString() unless and until you actually need it. A
File object is more useful.

Don't perform string operations to construct file paths.  For example,
write

File logDir = new File(pathDir, logg);
logDir.mkdirs();
File logFile = new File(logDir, generateLogDirName());
OutputStream logStream = new FileOutputStream(logfile);
BufferedWriter logWriter = new  BufferedWriter(new
OutputStreamWriter(logStream, UTF-8));

No toString() method needed -- wanted!

On Jan 14, 6:58 am, Kumar Bibek coomar@gmail.com wrote:
 The abolute path to the external storage might be different. The correct way
 to access the path is

 String fPathDir =
 Environment.
 getExternalStorageDirectory().toString();

 Don't care what it returns, just use this.

 Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com







 On Fri, Jan 14, 2011 at 1:59 PM, Nroblex aselb...@gmail.com wrote:
  Hello Gurus!

  I am very new to java and Android development. So this is perhaps a
  very simple question for you.

  I am developing on a HTC Desire and I am trying to create a loggdir on
  my storage card.
  if I use the suggested function getExternalStorageDirectory like this
  String fPathDir =
  Environment.getExternalStorageDirectory().toString();
  this returns /mnt/SdCard and not /SdCard.

  if I try to create a directory on in /mnt/SdCard/logg
  with mkdirs() it throws an exception, but if I create a directory in

  /SdCard/logg mkdirs() is successfull

  What am I missing here?

  Thanks in advance
  //Nroblex

  --
  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.comandroid-developers%2Bunsubs 
  cr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Re: getExternalStorageDirectory()

2011-01-16 Thread Kumar Bibek
Yup, thats better. :)

Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com



On Sun, Jan 16, 2011 at 11:15 PM, Bob Kerns r...@acm.org wrote:

 Actually, use:

 File pathDir = Environment.getExternalStorageDirectory();

 That is, don't use toString() unless and until you actually need it. A
 File object is more useful.

 Don't perform string operations to construct file paths.  For example,
 write

 File logDir = new File(pathDir, logg);
 logDir.mkdirs();
 File logFile = new File(logDir, generateLogDirName());
 OutputStream logStream = new FileOutputStream(logfile);
 BufferedWriter logWriter = new  BufferedWriter(new
 OutputStreamWriter(logStream, UTF-8));

 No toString() method needed -- wanted!

 On Jan 14, 6:58 am, Kumar Bibek coomar@gmail.com wrote:
  The abolute path to the external storage might be different. The correct
 way
  to access the path is
 
  String fPathDir =
  Environment.
  getExternalStorageDirectory().toString();
 
  Don't care what it returns, just use this.
 
  Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
 
 
 
 
 
 
 
  On Fri, Jan 14, 2011 at 1:59 PM, Nroblex aselb...@gmail.com wrote:
   Hello Gurus!
 
   I am very new to java and Android development. So this is perhaps a
   very simple question for you.
 
   I am developing on a HTC Desire and I am trying to create a loggdir on
   my storage card.
   if I use the suggested function getExternalStorageDirectory like this
   String fPathDir =
   Environment.getExternalStorageDirectory().toString();
   this returns /mnt/SdCard and not /SdCard.
 
   if I try to create a directory on in /mnt/SdCard/logg
   with mkdirs() it throws an exception, but if I create a directory in
 
   /SdCard/logg mkdirs() is successfull
 
   What am I missing here?
 
   Thanks in advance
   //Nroblex
 
   --
   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.comandroid-developers%2bunsubscr...@googlegroups.comandroid-developers%2Bunsubs
 cr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

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

[android-developers] Re: getExternalStorageDirectory() on NEXUS S

2011-01-04 Thread Tabman
Thanks Doug,

Your reply is very helpful, you also replied to another post of mine
so thanks again :)


On Dec 20 2010, 1:51 am, Doug beafd...@gmail.com wrote:
 On Dec 19, 2:14 pm, Tabman tabishfay...@gmail.com wrote:

  I have a question related to this. How many phones are out there with this
  type of behavior ? I want to access Camera Photos/Videos on a phone and for
  that I've used EXTERNAL_CONTENT_URI but it seems that approach would fail on
  a phone likeDroidIncredible. How should I design my app such that it is
  able to get camera data from any android phone ?

 It will fail on theDroidIncrediblebecause they didn't wire up that
 URI to point to the external storage mounted at, I think, /emmc.
 That's fragmentation for you.  (I think they did it wrong.)  But at
 least their camera app doesn't put content on the sdcard.  It's forced
 into the built-in space that will get picked up by the Android media
 scanner when it indexes EXTERNAL_CONTENT_URI.

 However, it works on Galaxy S devices because its built-in external
 space is wired to that URI --AND-- if you do have a sdcard in the
 device, it will mount THAT filesystem underneath the internal storage
 space.  So if the internal storage space was at /mnt/sdcard, your
 additional sdcard would be at /mnt/sdcard/external_sd.  And when the
 Android media scanner runs to index media referenced by
 EXTERNAL_CONTENT_URI, it will scan all of /mnt/sdcard, including the
 sdcard.  So they're doing it in a more compatible way that lets you
 get at the media on the user's sdcard in addition to the built-in
 space.

 I don't know what the Nexus S or HTC Hero do.  I also don't know what
 this Picasa Tool Pro does.  Maybe it doesn't query against the Android
 content providers for media and does its own thing instead.

 Doug

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


[android-developers] Re: getExternalStorageDirectory() on NEXUS S

2010-12-19 Thread Doug
On Dec 19, 2:14 pm, Tabman tabishfay...@gmail.com wrote:
 I have a question related to this. How many phones are out there with this
 type of behavior ? I want to access Camera Photos/Videos on a phone and for
 that I've used EXTERNAL_CONTENT_URI but it seems that approach would fail on
 a phone like Droid Incredible. How should I design my app such that it is
 able to get camera data from any android phone ?

It will fail on the Droid Incredible because they didn't wire up that
URI to point to the external storage mounted at, I think, /emmc.
That's fragmentation for you.  (I think they did it wrong.)  But at
least their camera app doesn't put content on the sdcard.  It's forced
into the built-in space that will get picked up by the Android media
scanner when it indexes EXTERNAL_CONTENT_URI.

However, it works on Galaxy S devices because its built-in external
space is wired to that URI --AND-- if you do have a sdcard in the
device, it will mount THAT filesystem underneath the internal storage
space.  So if the internal storage space was at /mnt/sdcard, your
additional sdcard would be at /mnt/sdcard/external_sd.  And when the
Android media scanner runs to index media referenced by
EXTERNAL_CONTENT_URI, it will scan all of /mnt/sdcard, including the
sdcard.  So they're doing it in a more compatible way that lets you
get at the media on the user's sdcard in addition to the built-in
space.

I don't know what the Nexus S or HTC Hero do.  I also don't know what
this Picasa Tool Pro does.  Maybe it doesn't query against the Android
content providers for media and does its own thing instead.

Doug


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