如您所见,有一些示例配置文件项目绑定到抽屉进行测试(它由 制成IProfile
),但我想从中获取它们arraylist<user>
这是示例代码:
final IProfile profile = new ProfileDrawerItem().withName(LoginActivity.loggedInUser.get(0).getMobile()+"").withEmail(LoginActivity.loggedInUser.get(0).getResponse()).withIdentifier(100);
final IProfile profile2 = new ProfileDrawerItem().withName("Bernat Borras").withEmail("alorma@github.com").withIdentifier(101);
final IProfile profile3 = new ProfileDrawerItem().withName("Max Muster").withEmail("max.mustermann@gmail.com").withIdentifier(102);
final IProfile profile4 = new ProfileDrawerItem().withName("Felix House").withEmail("felix.house@gmail.com").withIdentifier(103);
final IProfile profile5 = new ProfileDrawerItem().withName("Mr. X").withEmail("mister.x.super@gmail.com").withIdentifier(104);
final IProfile profile6 = new ProfileDrawerItem().withName("Batman").withEmail("batman@gmail.com").withIdentifier(105);
此配置文件将添加到accountHeader
和addProfiles(profile,profile1,...);
方法。
但我想从数组中设置配置文件项...我正在尝试IProfile
从我的用户中创建一个数组:
喜欢以这种方式获取个人资料:
if(!Arrays.userCars.isEmpty()) {
for (int i = 0; i <= Arrays.userCars.size(); i++) {
Arrays.profiles.add(new ProfileDrawerItem()
.withName(Arrays.userCars.get(i).getName())
.withEmail(Arrays.userCars.get(i).getCarCompany().toString())
.withIdentifier(103 + i));
}
}
profiles
但是如何从Array中获取这些项目并在addProfiles()
方法中使用?请记住,此方法来自库,我无法更改。