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
Developer
Posts: 28
Registered: ‎10-05-2009
My Device: Not Specified
Accepted Solution

Just looking for a nudge in the right direction

Hey Peeps,

 

I am bashing away at my first BB app and seem to be having a small problem, my app is basically pulling in an xml feed the items of which I am outputting as CustomButtons my problem is that these are dynamic and of varying qty.

For my hard coded buttons I have a changeListner set that allows me to push my new screen and what not but how do I implement something similar for my dynamic buttons? All the examples I have found on the web are just hard coded buttons which are no good to me Smiley Sad.

 

If any one gets my message in a bottle then any assitence will be most appreciated.

 

Thanks

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Just looking for a nudge in the right direction

you could

- store information about the generated buttons elsewhere, like an inthashtable or a vector

- use the setCookie method to set an identifier object

- use getLabel to identify the button

 

you can set the same changelistener to all buttons and identify the pressed one by using one of the options above.

 

if you want to display many clickable objects i would suggest that you take a look at ListField, it is performing a lot better, more customizable and easier to use.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 28
Registered: ‎10-05-2009
My Device: Not Specified

Re: Just looking for a nudge in the right direction

Thanks for the help Simon, I actually made myself a cup of coffee and woke up I wasnt implementing my code in "navigationClick"  so thats what I did just invoked my clash and a little push and we are back on cool runnings again.

 

 

protected boolean navigationClick(int status, int time)
	{
		Article loadFeed = new Article("News and Analysis", 0x0094CD, label, Desc);
		UiApplication.getUiApplication().pushScreen(loadFeed);
		
        return super.navigationClick(status, time);
	}