PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → Creating a SHARE button in Android
Creating a SHARE button in Android
Débuté par Luca Forti, 06 sep. 2017 10:21 - 1 réponse
Posté le 06 septembre 2017 - 10:21
Hi everyone, I'm trying to create a share button in my android application to open the share chooser and send a text.

I found this java code online (it works in Android Studio) but I can't make it work in WinDev:

import android.content.Intent;
import android.content.Context;
import android.app.Activity;


PUBLIC static void OpenShare()
{
// Context context;

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, "Send text..."));
}


I wrote the code in a global procedure but when I generate the app, the error is:

Failure creating the Android application named <C:\My Mobile Projects\XXXXXXXX\Exe\Android application\XXXXXXXX.apk>.


Command Line: "C:\Program Files\Java\jdk1.8.0_111\bin\java.exe" "-Dorg.gradle.appname=C:\My Mobile Projects\XXXXXXXX\Android\Generation" -classpath "C:\WINDEV Mobile 22\Personal\Android\Gradle\lib\gradle-launcher-2.14.1.jar" org.gradle.launcher.GradleMain assembleRelease -b "C:\My Mobile Projects\XXXXXXXX\Android\Generation\build.gradle"


Error returned:

:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
C:\My Mobile Projects\XXXXXXXX\Android\Generation\src\com\XXXXXXXX\XXXXXXXX\wdgen\GWDCPCOL_Java.java:31: error: <identifier> expected
PUBLIC static void OpenShare()
^
1 error
:compileReleaseJavaWithJavac FAILED

--------------------

Can someone help me?

Luca
Membre enregistré
794 messages
Popularité : +40 (42 votes)
Posté le 06 septembre 2017 - 11:46
Hi. Change "PUBLIC" to "public"

Rubén
Message modifié, 06 septembre 2017 - 11:47