PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → [WM17] Partager un texte sur Twitter, Facebook, etc
[WM17] Partager un texte sur Twitter, Facebook, etc
Débuté par zinehom, 11 mar. 2013 16:47 - 1 réponse
Posté le 11 mars 2013 - 16:47
Bonsoir, je cherche à partager du texte sur les réseaux sociaux, j'ai crée une procédure global en java:
import android.content.Intent;
import android.content.Context;
import android.widget.EditText;

public static void gPG_Share()
{
Context tmpContext = getContexteApplication();
EditText text;

text = (EditText) getView ("texte");
Intent MessIntent = new Intent(Intent.ACTION_CHOOSER);

MessIntent.setType("text/plain");
MessIntent.putExtra(Intent.EXTRA_TEXT, text.getText().toString());
tmpContext.startActivity(Intent.createChooser(MessIntent, "Partager avec..."));
}

après l’exécution de mon application, elle m'affiche l'erreur suivante:
erreur interne du framework wdjava.java.lang.NullPointerExecption
Posté le 23 mai 2013 - 18:44
Je coince aussi sur le meme sujet. on peut récupérer l'erreur avec

try {

... votre code

} catch(Exception e)
{
String sError = e.getMessage(); // "There are no email clients installed."
Toast.makeText(context,sError,Toast.LENGTH_LONG).show();
return "";
}


import android.view.*;
import android.content.Context;
import android.widget.TextView;
// http://doc.pcsoft.fr/es-ES/?particularites-des-applications-pour-android

public static String JavaComboLit(String champ)
{
// Variables
Context context = getApplicationContext();

try {

View viewChamp = (TextView) getView(champ);
//String sValue = viewChamp.getText() //cast return error 'cannot cast'
Toast.makeText(context,champ+sValue,Toast.LENGTH_SHORT).show(); // debug
//return sValue;
return "";


} catch(Exception e)
{
String sError = e.getMessage(); // "There are no email clients installed."
Toast.makeText(context,sError,Toast.LENGTH_LONG).show();
return "";
}
}