Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //В активити:
- NotificationsArrayAdapter adapter = new NotificationsArrayAdapter(this, R.layout.notifications, notifications);
- notificationsListView.setAdapter(adapter);
- notificationsListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
- //В NotificationsArrayAdapter:
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- //...
- ListView lvNotificationsGroups = (ListView) v.findViewById(R.id.subNotificationsList); // находим листвью
- String[] names = { "Иван", "Марья", "Петр", "Антон" };
- ArrayAdapter<String> adapter = new ArrayAdapter<String>(contextAdapter, android.R.layout.simple_list_item_1, names);
- lvNotificationsGroups.setAdapter(adapter);
- lvNotificationsGroups.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
- //...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement