Access to Internal Directories

margret

Well-Known Member
Licensed User
Longtime User
Does anyone know how to access directories on the internal memory. I know you have the commands: File.DirAssets, File.DirInternal, File.DirInternalCache,
File.DirRootExternal, File.DirDefaultExternal, etc. What I don't know is how to access some files on the internal memory I am after. There is a directory in the internal drive named: /My Files/Pictures. I don't know what is above this. Any way to access the root or these directories?

Thanks,

Margret
 

kickaha

Well-Known Member
Licensed User
Longtime User
I think the internal memory root is "system", but the use of it is quite restricted so I am not sure if you can access it correctly.

If you are wanting to select a picture why not have a look at ContentChooser, there is a very good thread on it HERE
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
If this folder is not restricted then you can access it by writing the folder name directly.

Hello Erel,

In the code below, how would you access it by the folder name directly as you stated?

Thanks,

Margret

B4X:
Adir = "what would you put here? I am wanting the built in memory of the NookColor"

If File.Exists(Adir, "/My Files/Pictures/") Then 
   wdir=Adir&"/My Files/Pictures/"
Else
   ToastMessageShow("No Files Found to Display", False)
        Return "CANCEL"
End If
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
Content Chooser


I did try this and it brings up the Images just fine. However, on the NookColor it also has video files in this same directory and it shows a thumbnail pic just like a .jpg. So they may select a video and not just an image. Any way you know to give a filter mask for .png, .jpg and .bmp?

Thanks,

Margret
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Heve you tried to use wildcards?

i.e: "/My Files/Pictures/*.jpg"
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User

Does it do this when you call the ContentChooser with the image mime type?

B4X:
ContentChooser.Show("image/*", "Choose image")
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
Content Chooser

Does it do this when you call the ContentChooser with the image mime type?

B4X:
ContentChooser.Show("image/*", "Choose image")

Yes, that is the exact code I called it with "image/*". It brings up a list of all pics and videos both. I did not try with "My Files/Pictures/*.jpg" because they could have .bmp, .gif and .jpg, etc. Below is the sample code I ran.

Thanks,

Margret

B4X:
'Activity module
Sub Process_Globals
End Sub
Sub Globals
   Dim GetImage As Button
   Dim ImageView1 As ImageView
End Sub
Sub Activity_Create(FirstTime As Boolean)
   cc.Initialize ("chooser")
   ImageView1.Initialize ("")
   GetImage.Initialize ("GetImage")
   ImageView1.Gravity = Gravity.Fill 
   Activity.AddView (ImageView1, 10dip, 100dip, 300dip, 300dip)
   GetImage.Text  = "Load Picture"
   Activity.AddView (GetImage,10dip, 10dip, 300dip, 60dip)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub GetImage_Click
   CC.Show("image/*", "Choose image")
End Sub
Sub chooser_Result (Success As Boolean, Dir As String, FileName As String)
   If Success Then ImageView1.Bitmap = LoadBitmap (Dir, FileName)
End Sub
 
Upvote 0

vb1992

Well-Known Member
Licensed User
Longtime User
B4X:
Sub chooser_Result (Success As Boolean, Dir As String, FileName As String)
   If Success Then ImageView1.Bitmap = LoadBitmap (Dir, FileName)
End Sub


Would you be looking for something more like:
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…