PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → displays the Image in looper after java code
displays the Image in looper after java code
Débuté par popoy, 01 déc. 2014 11:02 - 7 réponses
Posté le 01 décembre 2014 - 11:02
Hello everyone,
I wonder how I should change my code to the looper displays the Image

gtabApplicationsInstallés is array of STApplicationInstallee

STApplicationInstallee is structure
sNomPackageis string
nVersionCodeis int
sVersionName is string
sIcon is a Image
sLabel is string
END


// Init End of Window
ListeApplicationsInstallées()
AfficheApplications()

// Procedure Window
// Summary: Displays apps in the zr
Procedure AfficheApplications()
LooperDeleteAll(ZR_Applications)
FOR EACH stAppliInst OF gtabApplicationsInstallés
LooperAddLine(ZR_Applications,stAppliInst.sNomPackage,stAppliInst.nVersionCode,stAppliInst.sIcon,stAppliInst.sVersionName,stAppliInst.sLabel)
END

// Global procedure
// Summary: Lists the applications (non-system) installed and filled with an array
Procedure ListeApplicationsInstallées()

sRésultats is string
sNomPackage is string
sNumVersionPackage is string
stApplicationis STApplicationInstallee
sVersionName is string
sIcon is string
sLabel is string

sRésultats = APKListeInstallées(False)

ArrayDeleteAll(gtabApplicationsInstallés)

FOR EACH STRING sPackage OF sRésultats SEPAREE by "$SEP1$"
sNomPackage= ExtractString(sPackage,1,"$SEP2$")
sNumVersionPackage = ExtractString(sPackage,2,"$SEP2$")
sVersionName = ExtractString(sPackage,3,"$SEP2$")
sIcon = ExtractString(sPackage,4,"$SEP2$")
//info(sIcon)
sLabel = ExtractString(sPackage,5,"$SEP2$")
IF sNumVersionPackage = EOT THEN
sNumVersionPackage = 0
END

stApplication.sNomPackage = sNomPackage
stApplication.nVersionCode = sNumVersionPackage
stApplication.sVersionName = sVersionName
stApplication.sIcon = sIcon
stApplication.sLabel = sLabel

ArrayAdd(gtabApplicationsInstallés,stApplication)
END


//JAVA
import java.util.*;
import android.util.*;
import android.content.pm.*;

PUBLIC static string APKListeInstallées(boolean bAPKSystem){
string sRes = "";
List<PackageInfo> packs = getActiviteEnCours().getPackageManager().getInstalledPackages(0);

for(int i=0;i<packs.size();i++) {
PackageInfo p = packs.get(i);

IF(!bAPKSystem & ((p.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1)){
CONTINUE;
}

IF (p.versionName == null) {
CONTINUE ;
}
IF (sRes != ""){
sRes += "$SEP1$";
}
sRes += p.packageName;
sRes += "$SEP2$";
sRes += Integer.toString(p.versionCode);
sRes += "$SEP2$";
sRes += p.versionName;
sRes += "$SEP2$";
sRes += p.applicationInfo.loadIcon(getActiviteEnCours().getPackageManager());
sRes += "$SEP2$";
sRes += p.applicationInfo.loadLabel(getActiviteEnCours().getPackageManager()).toString();
}
RETURN sRes;
}
Membre enregistré
3 657 messages
Popularité : +175 (223 votes)
Posté le 01 décembre 2014 - 11:35
Hello,

1 - Add the image in a Sqlite or Hyperfile table in a blob field.
2 - Create a query that table with filters to find it necessary to localization of records
3 - create a form and place a looper pointing to this query.

Nice day for you

Att

Adriano
Posté le 01 décembre 2014 - 19:04
Adriano thank you
I am beginner in java
but in my java code I list the applications installed on android
I recovered all the text information without problem.
However, for the image I came to retrieve the id with

applicationInfo.loadIcon


and I would like recover the image of the application
But how is for saved in the application folder or the sd card from java?
Att

adrianoboller a écrit :
Hello,

1 - Add the image in a Sqlite or Hyperfile table in a blob field.
2 - Create a query that table with filters to find it necessary to localization of records
3 - create a form and place a looper pointing to this query.

Nice day for you

Att

Adriano
Membre enregistré
3 657 messages
Popularité : +175 (223 votes)
Posté le 03 décembre 2014 - 01:54
Posté le 14 mai 2014 - 14:21
Procedure CAM_SalvarDB(LOCAL ArquivoLocal,...
LOCAL Extensao,...
LOCAL Ambiente,...
LOCAL Crypto,...
LOCAL OpcaoEscolha,...
LOCAL CodigoArquivo,...
LOCAL CodOs,...
LOCAL CodOsItem,...
LOCAL NomeArquivo,...
LOCAL Descricao,...
LOCAL VideoFoto,...
LOCAL TempoSegundos,...
LOCAL FPS,...
LOCAL DebugSN)

//info("CAM_SalvarDB")
IF gsDebugSN = "S"
DebugSN="S"
END

UltimoCodigo is int = 0

IF VideoFoto = "Foto"
gloWidth = Middle(gsResolucao,1,3)
IF gloWidth = "" OR gloWidth = 0 THEN
gloWidth = 640
END
gloHeight = Middle(gsResolucao,5,3)
IF gloHeight = "" OR gloHeight = 0 THEN
gloHeight = 480
END
END


IF DebugSN = "S" THEN
NextTitle("MotolinkOs")
Info(gloWidth,gloHeight)
END


//T001 - Campos de Armazenamento dos arquivos

IF VideoFoto = "Foto"
T020Arquivo.Tipo020 = "Foto"
ELSE IF VideoFoto = "Video"
T020Arquivo.Tipo020 = "Video"
END

T020Arquivo.CodOrdemServico018 = GloCodOS

T020Arquivo.CodOrdemServicoStatus018 = GloCodItemOS

T020Arquivo.PathUrl020 = ArquivoNovo

T020Arquivo.Observacao020 = Descricao

T020Arquivo.DataHora020 = DateToString(DateSys()) +" - "+ TimeToString(TimeSys())


IF VideoFoto = "Foto"
T020Arquivo.FotoVideo020 = dLoadImage(ArquivoNovo,imgDefault,gloWidth,gloHeight)
ELSE IF VideoFoto = "Video"
T020Arquivo.FotoVideo020 = dLoadImage(ArquivoNovo)
END

ok = HAdd(T020Arquivo)

IF ok = True THEN

IF DebugSN = "S" THEN
NextTitle("MotolinkOs")
Info("Gravado na base de dados com sucesso!")
END

ok = HExecuteQuery(QRY_MAX_T020)
HReadFirst(QRY_MAX_T020,QRY_MAX_T020.Count_1,hKeepFilter)
UltimoCodigo = QRY_MAX_T020.Count_1

//Enviar para Webservice//
IF DebugSN = "S" THEN
NextTitle("MotolinkOs")
Info(Crypto,UltimoCodigo,CodOsItem,Descricao,DebugSN)
Info(CodOs, CodOsItem, ArquivoLocal, Extensao, NomeArquivo)
END

IF CodigoArquivo = 0 OR CodigoArquivo = "" THEN
CodigoArquivo = UltimoCodigo
END


//---------------------------------------------//
CAM_Enviar2WS( ArquivoLocal,...
Extensao,...
Ambiente,...
Crypto,...
OpcaoEscolha,...
CodigoArquivo,...
CodOs,...
CodOsItem,...
NomeArquivo,...
Descricao,...
VideoFoto,...
TempoSegundos,...
FPS,...
DebugSN )
//---------------------------------------------//


ELSE
//Importante exibir o erro
NextTitle("MotolinkOs")
Info("Erro ao gravar na base de dados",ErrorInfo())

END
Membre enregistré
3 657 messages
Popularité : +175 (223 votes)
Posté le 03 décembre 2014 - 01:55
Veja esse codigo:

IF VideoFoto = "Foto"
T020Arquivo.FotoVideo020 = dLoadImage(ArquivoNovo,imgDefault,gloWidth,gloHeight)
ELSE IF VideoFoto = "Video"
T020Arquivo.FotoVideo020 = dLoadImage(ArquivoNovo)
END
Membre enregistré
3 657 messages
Popularité : +175 (223 votes)
Posté le 03 décembre 2014 - 01:58
I think you are more complicated for your code because the WINDEV Mobile has this native command.

Eu acho que voce esta complicando de mais pelo seu código, pois o windev mobile possui esse comando nativo.
Membre enregistré
3 657 messages
Popularité : +175 (223 votes)
Posté le 03 décembre 2014 - 02:11
Send me the code that u are reading, ok
Posté le 04 décembre 2014 - 14:37
Sorry but WinDev Mobile does not list the intallées applications on Android.
My Java code that's what I do.
I lack the party associated image has each application.
LoadIcon is Drawable
I try with appelProcedureWL but I find myself with information
android.graphics.drawable.BitmapDrawable@40fb2d60