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
pfiffi78
Posts: 242
Registered: ‎01-29-2009
My Device: Not Specified

How to implement a List Screen

Hi,

 

RIM suggests to use a List Screen for social networking applications. Does anybody have a few hints where to start? To me it doesn't look like using a ListField, but rather a VerticalLayoutManager with some sort custom (??) fields/components in it?

 

Thanks.

 

Daniel

 

Please use plain text.
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: How to implement a List Screen

Take a look at ListField class and ListFieldCallback interface.

 

Make a screen that extends MainScreen class and implements ListFieldCallback interface.

 

And in this screen class use the following code to populate screen:

 

private ListField listField = new ListField();

 

......

 

// constructor

public MyScreen() {

      listField.setCallback(this);

 

 

}

 

that's it.

Please use plain text.
Developer
pfiffi78
Posts: 242
Registered: ‎01-29-2009
My Device: Not Specified

Re: How to implement a List Screen

Thank you.. But I am still wondering where the layout for the ListFields is coming from. Obviously, the default layout is just a checkbox with a label behind. But I am more interested in list fields similar to the ones in the Email application or the App World application where you have multiple lines of text and also an icon at the beginning.

 

 

Please use plain text.
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: How to implement a List Screen

Please use plain text.
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: How to implement a List Screen

Check links I provided.

 

There are also zip files with sample codes below of every article.

 

Also as you are a newbie check this link:

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&thread.id=13264&jump=true

 

there is helpful information for you

Please use plain text.
Developer
pfiffi78
Posts: 242
Registered: ‎01-29-2009
My Device: Not Specified

Re: How to implement a List Screen

Ok thank you.. will give it a try and see how far I get :smileyhappy:

 

Please use plain text.
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: How to implement a List Screen

You are welcome.

 

To show an icon in list row use drawBitmap() method of Graphics instance in drawRow() of ListFieldCallback.

 

Draw bitmap and draw text at the right side of bitmap.

 

That's it.

Please use plain text.
Developer
pfiffi78
Posts: 242
Registered: ‎01-29-2009
My Device: Not Specified

Re: How to implement a List Screen

Hi,

 

Thanks again for all the right pointers. Got already something working. Great.

 

One last question: Is it possible to change the color of the selection, ie when you scroll throught the rows, the selected one is hightlighted. In my case it's blue, which I guess is determined by the current theme. Is it possible to change this color for a list field on the fly depending on the content of the selected row?

 

Thanks.

 

Daniel

Please use plain text.
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: How to implement a List Screen

In case you are working with standard ListField instance - there is no way to change the selection row color.

 

It depends on the current theme, you're right.

 

If it is critical for you - then implement your own list field control.

 

Please use plain text.