| |
Membre enregistré 3 655 messages Popularité : +175 (223 votes) |
|
Posté le 26 juillet 2016 - 20:04 |
Prezados,
Segue exemplo de uma Procedure JAVA para Windev Mobile detectar o nivel da bateria do celular / tablet:
import android.content.*;
PUBLIC static void LitEtatBatterie(string champDeSaisie) { contentTxt = (TextView) getView(champDeSaisie); getActiviteEnCours().registerReceiver(mBatInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); }
static TextView contentTxt;
static BroadcastReceiver mBatInfoReceiver = new BroadcastReceiver(){ PUBLIC void onReceive(Context arg0, Intent intent) { int level = intent.getIntExtra("level", 0); contentTxt.setText(string.valueOf(level)); } };
Obrigado Pedroso!
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 9949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 655 messages Popularité : +175 (223 votes) |
|
Posté le 27 juillet 2016 - 13:18 |
import android.content.*;
PUBLIC static void LitEtatBatterie(string champDeSaisie) { contentTxt = (TextView) getView(champDeSaisie); getActiviteEnCours().registerReceiver(mBatInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); }
static TextView contentTxt;
static BroadcastReceiver mBatInfoReceiver = new BroadcastReceiver(){ PUBLIC void onReceive(Context arg0, Intent intent< /FONT>) { int level = intent.getIntExtra("level", 0); contentTxt.setText(string.valueOf(level)); } };
And you can call it like this:
LitEtatBatterie("SAI_Batterie")
LitEtatBatterie is the name of the procedure
SAI_Batterie is the name of the control to show the value.
Please do not hesitate to contact me for any additional information.
Best Regards
Jerome Aerts
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 9949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 655 messages Popularité : +175 (223 votes) |
|
Posté le 10 août 2016 - 23:00 |
RESULTADO:
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 9949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 655 messages Popularité : +175 (223 votes) |
|
Posté le 10 août 2016 - 23:02 |
CÓDIGO ORIGINAL:
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 9949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 123 messages Popularité : +46 (46 votes) |
|
Posté le 11 août 2016 - 20:32 |
Outro metodo , menos convencional seria este (este metodo, não requer de uma tela ou campo text, podendo ser usada em background)
-- Atte. Willian FernandoMessage modifié, 11 août 2016 - 20:39 |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 655 messages Popularité : +175 (223 votes) |
|
Posté le 12 août 2016 - 13:29 |
Willian!!!!
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 9949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | |
| |
Posté le 23 décembre 2016 - 11:19 |
Hello Adriano,
Code Windev : LitEtatBatterie("SAI_Batterie")
code java: // Affiche le pourcentage de batterie restant dans un champ de saisie import android.content.*;
PUBLIC static void LitEtatBatterie(string champDeSaisie) { // Récupération du champ de saisie qui affichera le niveau de batterie contentTxt = (TextView) getView(champDeSaisie); getActiviteEnCours().registerReceiver(mBatInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); }
// champ de saisie qui affichera le niveau de batterie static TextView contentTxt;
static BroadcastReceiver mBatInfoReceiver = new BroadcastReceiver(){ PUBLIC void onReceive(Context arg0, Intent intent) { int level = intent.getIntExtra("level", 0); contentTxt.setText(string.valueOf(level)); } };
Errors in APK generation:
Echec de la création de l'application Android <E:\WMobile20\EXPRESS_Mon_Projet\Exe\EXPRESS_Application Android\EXPRESS_xxxx.apk>.
Ligne de commande : "C:\Program Files\Java\jdk1.8.0_72\bin\java.exe" "-Dorg.gradle.appname=E:\WMobile20\EXPRESS_Mon_Projet\Android\Generation" -classpath "E:\WMobile21express\Personnel\Android\Gradle\lib\gradle-launcher-2.8.jar" org.gradle.launcher.GradleMain assembleDebug -b build.gradle
Erreur retournée : E:\WMobile20\EXPRESS_Mon_Projet\Android\Generation\src\com\yyy\xxxx\wdgen\GWDCPProceduresJAVA.java:79: error: <identifier> expected PUBLIC static void LitEtatBatterie(string champDeSaisie) { ^ E:\WMobile20\EXPRESS_Mon_Projet\Android\Generation\src\com\yyy\xxxx\wdgen\GWDCPProceduresJAVA.java:89: error: <identifier> expected PUBLIC void onReceive(Context arg0, Intent intent) { ^ E:\WMobile20\EXPRESS_Mon_Projet\Android\Generation\src\com\yyy\xxxx\wdgen\GWDCPProceduresJAVA.java:89: error: invalid method declaration; return type required PUBLIC void onReceive(Context arg0, Intent intent) { ^ 3 errors FAILED
An idea? Merry Christmas
Carlos |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 655 messages Popularité : +175 (223 votes) |
|
Posté le 23 décembre 2016 - 11:37 |
Good morning.
Change the minuscule magnitude that works, the forum changes to Upper the word PUBLIC and it is not.
Only that
Call me on skype: adrianoboller and I'll send the source.
===
Bom dia
Altere o maiusculo minusculo que da certo, o forum muda para Upper a palavra PUBLIC e nao é.
Só isso
Me chame no skype: adrianoboller que te mando o fonte.
OK
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 9949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/Message modifié, 23 décembre 2016 - 11:37 |
| |
| |
| | | |
|
| | |
| |
Posté le 29 mars 2017 - 17:41 |
Tentei fazer o código funcionar mas quando tentei gerar ocorreram esses 2 erros:
error: cannot find symbol static TextView contentTxt;
error: cannot find symbol contentTxt = (TextView) getView(champDeSaisie);
symbol: class TextView location: class GWDCPGlobalProcedures 2 errors FAILED
Busquei resolver mas não consegui... |
| |
| |
| | | |
|
| | |
| |
Posté le 08 septembre 2017 - 15:41 |
Hello sir,
I am contacting you about the post you left on the PC Soft forum in July 2016.
I can not run this code, Windev always returns the following error: "Invalid parameter type".
Yet the code is the same as the one you presented:
// Affiche le pourcentage de batterie restant dans un champ de saisie import android.content.*;
PUBLIC static void LitEtatBatterie(string champDeSaisie) { // Récupération du champ de saisie qui affichera le niveau de batterie contentTxt = (TextView) getView(champDeSaisie); getActiviteEnCours().registerReceiver(mBatInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); }
// champ de saisie qui affichera le niveau de batterie static TextView contentTxt;
static BroadcastReceiver mBatInfoReceiver = new BroadcastReceiver(){ PUBLIC void onReceive(Context arg0, Intent intent< /FONT>) { int level = intent.getIntExtra("level", 0); contentTxt.setText(string.valueOf(level)); } };
I work with Windev Mobile 22, latest version.
Could you help me because I do not see any solution?
Thank you in advance.
Best Regards,
Gaël L. |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 655 messages Popularité : +175 (223 votes) |
|
Posté le 08 septembre 2017 - 17:07 |
MAIUSCULO NO LUGAR ERRADO VEJA A IMAGEM ABAIXO:
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 123 messages Popularité : +46 (46 votes) |
|
Posté le 08 septembre 2017 - 21:28 |
JAVA is case Sensitive
PUBLIC is different from public
Gaël L. a écrit :
Hello sir,
I am contacting you about the post you left on the PC Soft forum in July 2016.
I can not run this code, Windev always returns the following error: "Invalid parameter type".
Yet the code is the same as the one you presented:
// Affiche le pourcentage de batterie restant dans un champ de saisie import android.content.*;
PUBLIC static void LitEtatBatterie(string champDeSaisie) { // Récupération du champ de saisie qui affichera le niveau de batterie contentTxt = (TextView) getView(champDeSaisie); getActiviteEnCours().registerReceiver(mBatInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); }
// champ de saisie qui affichera le niveau de batterie static TextView contentTxt;
static BroadcastReceiver mBatInfoReceiver = new BroadcastReceiver(){ PUBLIC void onReceive(Context arg0, Intent intent< /FONT>) { int level = intent.getIntExtra("level", 0); contentTxt.setText(string.valueOf(level)); } };
I work with Windev Mobile 22, latest version.
Could you help me because I do not see any solution?
Thank you in advance.
Best Regards,
Gaël L.
-- Atte. Willian Fernando |
| |
| |
| | | |
|
| | |