AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones específicas para móviles / Funciones URI
  • Selecting a resource
  • Management of the conversion type
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Otros
Procedimientos almacenados
Retrieves information of a URI resource.
Ejemplo
AndroidWidget Android
// Ouvre la fenêtre système pour la sélection d'une ressource
UriRessource is URI = URISélecteur()
IF NOT ErrorOccurred THEN
	// Affiche le nom de la ressource sélectionnée
	Info(URIGetInfo(UriRessource, uriInfoName))
END
AndroidWidget Android
// Sauvegarde d'une ressource avec conversion 
UriRessource is URI = URISélecteur()
IF NOT ErrorOccurred THEN
	// Récupère le type MIME dans lequel la ressource peut être convertie
	sTypeMIME is string = URIRécupèreInfo(UriRessource, uriInfoConversionType)
	IF sTypeMIME <> "" THEN
		// S'il y a plusieurs types MIME possibles
		IF StringCount(sTypeMIME, CR) > 1 THEN
			// Demander à l'utilisateur de choisir le type à utiliser
			...
		END
		// Enregistre la ressource sur l'appareil
		URIToFile(UriRessource, SysDirExternalStorage(1, sseAppDocument), ...
					ProcFinEnregistre, sTypeMIME)
		INTERNAL PROCEDURE ProcFinEnregistre(bResultat, sCheminRessource)
			IF bResultat THEN
				ToastDisplay(StringBuild("Fichier enregistré (%1)", ...
						sCheminRessource))
			END
		END
	END
END
Sintaxis
<Result> = URIGetInfo(<URI> , <Information>)
<Result>: Character string or Integer
Requested information.
If an error occurs, the ErrorOccurred variable is set to True. To get more details on the error, use ErrorInfo.
<URI>: URI or Character string variable
Name of the URI variable or character string that identifies the resource being handled.
<Information>: Integer constant
Requested type of information:
uriInfoConversionType MIME types (and corresponding file extensions) into which the resource can be converted when being exported. In this case, <Result> will correspond to a character string in the following format:
<Type MIME> + TAB + <Extension>

Example: "application/pdf + TAB + pdf
If the function returns several types, they will be separated by CR.
For more details, see the Remarks of this page.
uriInfoNameName of the resource (without extension).
uriInfoOriginTypeOriginal MIME type of the resource and corresponding file extension. In this case, <Result> will correspond to a character string in the following format:
<Type MIME> + TAB + <Extension>

Example: "application/pdf + TAB + pdf
uriInfoSizeSize of the resource. <Result> will correspond to an integer:
  • Size of the resource (in bytes).
  • -1 if the size is not known or cannot be retrieved.
Observaciones

Selecting a resource

To select a resource and get its URI, use URISelect.

Management of the conversion type

The constant uriInfoConversionType makes it possible to retrieve the MIME types in which the resource can be converted.
This information is especially useful when using URIToFile and URIToBuffer to determine the format in which the resource will be retrieved. Indeed, when selecting a resource that does not come from the device's file system, the content provider that manages the resource may need to convert it.
This is usually the case if no application on the device can manage the original format of the resource. If the resource can be exported without conversion, URIGetInfo will return the same value as with the constant uriInfoOriginType.
Example:
a Microsoft Word file (.doc or.docx) is selected using URISelect. This file is on Google Drive and no application on the device can handle this type of document. When saving this resource, the content provider will automatically convert this resource to PDF format. In this case, URIGetInfo used with the constant uriInfoConversionType will return the following string: "application/pdf + TAB + .pdf".
Componente: wd300android.aar
Versión mínima requerida
  • Versión 24
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 02/07/2024

Señalar un error o enviar una sugerencia | Ayuda local