Contoh kode: Menampilkan isi kotak profil pengguna
Contoh kode berikut mengasumsikan bahwa kelas yang menampilkan MyUserProfileBoxScreen telah memberikan referensi untuk objek BBMPlatformContext yang terkait dengan aplikasi ini ke konstruktor MyUserProfileBoxScreen.
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 net.rim.device.api.util.*;
import java.util.*;
public class MyUserProfileBoxScreen extends MainScreen
{
public MyUserProfileBoxScreen(BBMPlatformContext platformContext)
{
UserProfile userProfile = platformContext.getUserProfile();
UserProfileBox userProfileBox = userProfile.getProfileBox();
if (userProfileBox.isAccessible())
{
UserProfileBoxItem[] items = userProfileBox.getItems();
for(int i = 0; i < items.length; i++) {
UserProfileBoxItem profileItem = items[i]
Bitmap icon = userProfileBox.getIcon(profileItem.getIconId());
myScreen.add(new BitmapField(icon));
myScreen.add(new LabelField(profileItem.getText()));
}
}
}
}
Topik berikutnya: Menambahkan item ke kotak profil pengguna
Topik sebelumnya: Menampilkan isi kotak profil pengguna
Apakah informasi ini berguna? Kirimkan komentar Anda kepada kami.