creatring file on sd card

stilltheone

Member
Licensed User
dim TR_out as TextWriter

TR_out.Initialize(File.OpenOutput(fd.FilePath, Test_3, False))

fd.FilePath is "/mnt/sdcard2"
Test_3 is "/test.tst"

Works with internal storage but error file not found / permission when going to external sdcard2

opening an existing file on the external works and shows the path I am using.

I tried adding the permission string
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

It did not work but I am not sure that I edited the html file correctly.
What editor is best for editing this file?
 

Erel

Administrator
Staff member
Licensed User
I moved this thread to Basic4android sub-forum.

You should use File.DirRootExternal. It will add the required permission.
If you want to write the path yourself then add the following code somewhere in your program.
B4X:
Dim s As String
s = File.DirRootExternal

You can use any text editor to edit the manifest file.
See this tutorial about modifications to the manifest file: PreferenceActivity tutorial
 
Upvote 0

stilltheone

Member
Licensed User
writing to external sd

I am still not able to write to the external sd card.

I can write to /mnt/sdcard/*.* and /mnt/sdcard/sd/*.* but not the external /mnt/sdcard2/*.* (external sd slot)

The permission line for write to external strage is in the html file.

This is a toshiba thrive 10.1 tablet with 16gig internal sd and a 4 gig sd card in the external slot.

What am I missing here?
 
Upvote 0

stilltheone

Member
Licensed User
Yes, I have those lines and it puts the permision string in the html file.
DirRootExternal returns "/mnt/sdcard".
The "external sd card" designation as returned by the file command is actually "/mnt/sdcard2".
I believe it is opening a file from this path to read, but not write.
Gives a permission error.
 
Upvote 0

Hubert Brandel

Active Member
Licensed User
Hi,

My Galaxy S plus smartphone has on internal external SD (not removeable)
and a second external SD-slot with my own SD-MINI card inside.

The second SD card is a subdir under the File.DirRootExternal

\mnt\sdcard == File.DirRootExternal
\mnt\sdcard\external_sd => this is my own sd-card

Do you have a filemanager ?

I use "Dateimanager" so I can walk through the dirs and test what I can do ...
or delete files I not want to have ...
 
Upvote 0

dagnabitboy

Active Member
Licensed User
For what it's worth: I have a similar problem with my Visio tablet. It has the directory /mnt/sdcard/ which refers to internal "sd card" storage. It's very confusing. When you manage an app and try to move it to SD card, it is actually just moving it to the internal space, which of course accomplishes nothing. My actual external sd card appears at /mnt/sdcard/external/. I have no idea why they do this, or what the solution is!
 
Upvote 0

stilltheone

Member
Licensed User
external SD Card the real one

Ok so external and external are not always the same. Gotta love standardization.
Loaded "Astro File Manager"
Under /mnt it shows sdcard and sdcard2
In the device list it shows "External SD Card"
OK.
But when I select External SD Card it wants to create a directory and if I say yes it fails.

Just for haha's I opened a file that Ithought I created on this SD when I bought the tablet.
When I edit it and go to save it it says read only save with different name.
When I try that it fails.

It seams I never could write to this device or it changed somewhere along the road?????


http://forums.toshiba.com/t5/THRiVE...erly-after-update-from-3-1-to-3-2/td-p/238836

Check this link.
It seams it is the latest version of android made the external devices all read only.


I will try a different SD card later and see what happens.
 
Last edited:
Upvote 0

SPLatMan

Member
Licensed User
SD Card won't work properly after update from 3.1 ... - Toshiba Forums

Check this link.
It seams it is the latest version of android made the external devices all read only.


I will try a different SD card later and see what happens.

I just spent time on that forum. It seems there is/was a problem writing to an external SD card on a Toshiba Thrive tablet, introduced by upgrading from Android 3.1 to 3.2. The solution seems to be (quoting a forum post that post-dates the OP):

02-17-2012 01:40 PM

OK. Here is the fix nice and easy (at least for me). Tested with USB stick.

Take your SD card or USB stick and copy all data to your PC
Format using exFAT using a PC
Copy your files back to SD or USB
Put in Thrive and off you go

This is very high level explanation. If you need more details let me know and if I got time I can give step by step. Remember that Google is your freind in finding out how to...

and a follow-up
Re: SD Card won't work properly after update from 3.1 to 3.2
[ Edited ]
02-18-2012 06:59 PM - last edited on 02-18-2012 07:00 PM

TGRBLL - Your soultion worked for me. 16gb Thrive (android version 3.2.1) (kernal version 2.6.36.3-00020-g3d351b6), with a 32gb sdcard. ES Files Explorer and Officesuite Pro 5 (paid) are able to read/write and edit files on the SDCARD2.

To anyone having trouble with this soultion make sure you go to SETTINGS--APPLICATIONS--MANAGE APPLICATION--ALL and CLEAR DATA and CLEAR CACHE for the applications you want to get working. Thanks.

Disclaimer: I've not tried this. I am just reading up on how to create/write files from my own b4a app, and decided to share.

David Stonier-Gibson
Samsung Galaxy ACE, 2.3.4
SPLat Controls - OEM Embedded Machine Controllers
 
Upvote 0
Top