Échantillon de code : envoi d'un fichier à un contact
L'échantillon de code suivant suppose que la classe qui a affiché MyBBMScreen a accès à l'objet BBMPlatformContext pour cette application et l'a transmis au constructeur MyBBMScreen.
import net.rim.blackberry.api.bbm.platform.*;
import net.rim.blackberry.api.bbm.platform.service.*;
public class MyBBMScreen extends MainScreen
{
public MyBBMScreen(BBMPlatformContext platformContext)
{
BBMPlatformContactList contacts = platformContext.getUIService().showContactPicker("Send File To", ContactListProvider.BBM_CONTACTS_WITH_APP, false, false);
if (contacts.size() > 0)
{
BBMPlatformContact contact = (BBMPlatformContact)contacts.getAll().nextElement();
FilePicker filePicker = FilePicker.getInstance();
String filePath = filePicker.show();
platformContext.getMessagingService().sendFile(contact, filePath, "Here's the file");
}
}
}
Sujet précédent: Envoyer un fichier à un contact
Ces informations vous ont-elles été utiles ? Envoyez-nous vos commentaires.