I’m trying to access images stored on my Android phone. I used the simple OpenDialog example of getting a picture.
[code] // get image from phone
Dim jpegType As New FileType
jpegType.Name = “image/jpeg”
jpegType.Extensions = “jpg;jpeg”
Dim f As FolderItem = GetOpenFolderItem(jpegType)
If f is Nil Then
//user cancelled
Return
End if
Canvas1.Backdrop = Picture.Open(f)
If Canvas1.Backdrop Is Nil Then
MsgBox “Nil”
End if[/code]
The OpenDialog window displays the pictures from my phone just fine. Selecting one of the images from the phone’s camera folder places the file name in the appropriate field just fine. BUT when I click OPEN, the result returned is Nil. I can choose any picture from any other location on my hard drive using the same code and everything works fine including placing the image on the canvas as the code calls for.
if you select it and try to drag an image from there to the desktop does that work ?
seems to me that if that works Xojo should be able to read it as well
What you see in the explorer is NOT a file system. The device is conected throug the Media Transfer Protocol (MTP)
Windows explorer just comunicates to the device and display the contents. Xojo implementation of FolderItem is limited and doesnt include support for MTP.
Maybe I don’t understand MTP but how come I can access the phone folder with pictures using the “Open” command (using the Open Dialog box) in Photoshop and the picture opens right up in the application? Also, it doesn’t make sense that if Windows Explorer is only “displaying the contents” then how come I can drag an image from the phone to my desktop using Windwos Explorer? I am also able to use the “Insert Picture” function in MS Word and MS Powerpoint and access/insert pictures from the phone folder. Matter of fact, there’s not one application on my computer that doesn’t allow accessing the images in that manner from the phone. Do you mean that they are ALL using MTP??? What are those application “Open Dialog” functions doing that the Xojo OpenDialog function doesn’t?
you are not dragging an “actual” image, explorer just transfers the file using MTP in the background. It is like you are saying that downloading a file using http with the browser is the same as coping from the server and and pasting in your pc
Yes
MTP stuff. API Calls. This is like asking why Photoshop can open a SVG and xojo cant.
Well, it’s CERTAINLY needed by me! I’ve got to believe that with something as mundane as browsing for pics on a phone that there would be a number of others who would need that same functionality.
My problem is an immediate one, in that, I have an appointment at Walmart headquarters in Arkansas next Wednesday where I need to demonstrate something that requires the desktop app (Xojo) I’ve developed to access and display images off an Android phone. Obviously, potential customers don’t get much bigger than Walmart … which leads me to ask you, Christian … just how soon could you have such a plug-in?
… Just when I thought I was coming to grips with the constraints of MTP
Thank you for trying that, Javier! I have a Surface PRO 6 tablet with Windows 10 on it. I’ll download the latest Xojo release and give it a try. Now, I’m REALLY curious!!!
Emile, thanks for your thoughtfulness and the suggestion. I can see the logic to your thought process there.
Ivan … thanks for being patient with me while I’m coming to grips with MTP. I sincerely appreciate your responses and the “education” you afforded me.
This protocol is used to avoid conflicts with the OS and also to save on some patent fees from file systems. As a work around for your demo, maybe you culd find and old enought phone that has mass storage capabilities.
in android just go to USB settings and check if the usb connection mode has the Mass storage mode.