Codebeispiel: Aktualisieren des Benutzerprofils
Im folgenden Codebeispiel wird davon ausgegangen, dass die Klasse, die MyUserProfileScreen angezeigt hat, einen Verweis auf das mit der Anwendung verknüpfte BBMPlatformContext-Objekt an den MyUserProfileScreen-Konstruktor übergeben hat.
import net.rim.blackberry.api.bbm.platform.*;
import net.rim.blackberry.api.bbm.platform.profile.*;
import net.rim.device.api.system.*;
import net.rim.device.api.ui.component.*;
import java.util.*;
public class MyUserProfileScreen extends MainScreen
{
public MyUserProfileScreen(BBMPlatformContext platformContext)
{
UserProfile userProfile = platformContext.getUserProfile();
boolean allowed = userProfile.setStatus(Presence.STATUS_BUSY, "I am busy.");
if(! allowed)
{
int result = Dialog.ask(Dialog.D_YES_NO, "Would you like CoolApp to
stop updating your profile status?");
if(result == Dialog.YES)
{
// Optional code to prevent the application from asking to update
// the user's status
}
}
}
}
Nächstes Thema: Benutzerprofilfeld
Vorheriges Thema: Aktualisieren des Benutzerprofils
Waren diese Informationen hilfreich? Senden Sie uns Ihren Kommentar.