Android Question Accessing files on external sd card

Penfound

Active Member
Licensed User
Longtime User
Sorry I can't post any code yet because I haven't found anything that works.

I have a Galaxy Tab 2 10.1 with a 32GB SD Card for external storage. I have seen Erel and other's comments about the DirRootExternal not referring to the external SD Card but to the internal one but how do I display a PDF file stored on the external card?

I am currently working with a reduced data set which takes up just 18GB which is why I can't just place it all in the DirAssets folder. I could move a particular file to that folder but I can't find any way of getting it from the external card.

Can anyone help please? This is turning into the very high brick wall at the moment.

Cheers
Penfound
 
You can try the code below to show the paths on the device. NOTE: This will not work with the new JB OS.

Code: Copy
Sub DevicePaths
     Dim lp, dPaths As List : Dim ChkVal, dp = File.DirRootExternal As String : dPaths.Initialize
     lp = File.ReadList("/system/etc/", "vold.fstab")
     For i = 0To lp.Size -1
          ChkVal = lp.get(i) : ChkVal = ChkVal.Replace(":", " ")
          If ChkVal.ToLowerCase.StartsWith("dev_mount") Then
               dPaths.Add(SGW(ChkVal, 2) & ", " & SGW(ChkVal, 3))
          EndIf
     Next
     InputList(dPaths, "Device Mounting Paths", -1)
End Sub
 
Sub SGW(CStr As String, GE As Int) As String
     Dim t As List : Dim rs, sd As String : sd = " "
     t = Regex.Split(sd, CStr)
     rs = t.Get(GE-1)
     Return rs
End Sub
 
Upvote 0
Thank you margret.
My tablet has just upgraded to Android 4.2.2 and you code works perfectly as below.

Code: Copy
 Private Sub DevicePaths()
      Dim lp, dPaths As List : Dim ChkVal, dp = File.DirRootExternal As String : dPaths.Initialize
     lp = File.ReadList("/system/etc/", "vold.fstab")
     For i = 0 To lp.Size -1
          ChkVal = lp.get(i) : ChkVal = ChkVal.Replace(":", " ")
          If ChkVal.ToLowerCase.StartsWith("dev_mount") Then
               dPaths.Add(SGW(ChkVal, 2) & ", " & SGW(ChkVal, 3))
          End If
     Next
     InputList(dPaths, "Device Mounting Paths", -1)

 End Sub
Private Sub SGW(CStr As String, GE As Int) As String
     Dim t As List : Dim rs, sd As String : sd = " "
     t = Regex.Split(sd, CStr)
     rs = t.Get(GE-1)
     Return rs
End Sub
 
Upvote 0
Back
Top