PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV Mobile 2024 → [WM17] Partager un texte sur Twitter, Facebook, etc
[WM17] Partager un texte sur Twitter, Facebook, etc
Started by zinehom, Mar., 11 2013 4:47 PM - 1 reply
Posted on March, 11 2013 - 4:47 PM
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
Posted on May, 23 2013 - 6:44 PM
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 "";
}
}