Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
Posts: 9
Registered: ‎11-12-2010
My Device: Blackberry Curve 8520
My Carrier: Celcom - Vodafone
Accepted Solution

How to create a list of button using names from an array

hi, i want to create an application that displays a detailed information about something. for example like the profile of the users. my application will read an xml response from the server that includes the list of names of the users. How to create a list of buttons using the names and then each button which shows the name that can be pressed and displayed the detailed information about the name ? i think it is similar to BBM app which shows a list of the user's contact. thanks a lot 

Developer
Posts: 174
Registered: ‎01-25-2011
My Device: Not Specified

Re: How to create a list of button using names from an array

Create an Array of ButtonField like:

 

ButtonField[ ] users_buttons=new ButtonField[number of Users];

 

Initialize dem uasing:

 

for(int i=0;i<no.ofusers;i++)

users_buttons[i]=new ButtonField("user no.",Field.FIELD_HCENTER|ButtonField.CONSUME_CLICK);

 

Make dem Clickable using  setchangeListener method of buttonField and Ooveride Navigation click to do some operatoin on clicking specific Button!!

New Contributor
Posts: 9
Registered: ‎11-12-2010
My Device: Blackberry Curve 8520
My Carrier: Celcom - Vodafone

Re: How to create a list of button using names from an array

thanks mate, your idea is very helpful.

Developer
Posts: 271
Registered: ‎12-24-2010
My Device: BlackBerry 10
My Carrier: Airtel

Re: How to create a list of button using names from an array

What kiran told thats exactly right. If you want to place the button in horizontally or vertically then you have to use some managers. And when you click each button you can push one screen to see every users profile or something like that.  This you can do using fieldChanged() method.