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
Contributor
Posts: 22
Registered: ‎03-19-2013
My Device: curve
My Carrier: iam

Add items to ListField and create Events

hi every one

i want to create a list using " List Field " but the problem is :

 

1 - I do not know how to add informations (rows ) to this list .

2 - if I you help me to fill my list , how can I show data in a row as a dialog.inform when someone click on this row

here is my code

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Add items to ListField and create Events

[ Edited ]

Do you mean ListField?

 

Is this a continuation of your previous Thread?

http://supportforums.blackberry.com/t5/Java-Development/Creat-a-list-in-blackberry-project/m-p/22612...

 

Regarding supplying data to a ListField, I thought there were a number of samples around that helped with that.  Have you tried one?  What don't you understand from that?

 

Regarding adding entries, Simon has suggested one approach.  Personally I often just create a new ListField and replace the one on display. 

 

Regarding showing the data, on the other Thread I've pointed out there are various discussions on this forum regarding clickable ListField entries.  If you are actually creating a ListField, one of these should help you.

 

If you are using SimpleList, sorry can't really help, I still develop for OS 5.0 and so have stuck with ListField. 

Contributor
Posts: 22
Registered: ‎03-19-2013
My Device: curve
My Carrier: iam

Re: Add items to ListField and create Events

yes i used simpleList but my problem was :
"how can create event for eche row of this list "
when i search in the internet everyone tells me to use ListField "it's easy" so my problem became :
"how can i add item to my listfield "
like i do in my simpleList <liste.add(.......);>

so please help me with this listfield
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Add items to ListField and create Events

SimpleList has the setCommand() method which from my reading, does exactly this:

"how can create event for eche row of this list"

 

Have you looked at using this method()?

 

Regarding how to add entries, there are a number of approaches. I think the best way of investigating this is for you to give us a small small ListField that you are using and we can suggest how you would add an entry to that ListField. 

 

If you are not going to continue your previous Thread, can you close it off in some way, perhaps adding a post that points to this Thread?

Contributor
Posts: 22
Registered: ‎03-19-2013
My Device: curve
My Carrier: iam

Re: Add items to ListField and create Events

here is my code

package mypackage;

import net.rim.device.api.ui.component.ListField;
import net.rim.device.api.ui.container.MainScreen;

/**
* A class extending the MainScreen class, which provides default standard
* behavior for BlackBerry GUI applications.
*/
public final class MyScreen extends MainScreen
{
/**
* Creates a new MyScreen object
*/
public MyScreen()
{
// Set the displayed title of the screen
setTitle("MyTitle");
Activity Ac; // it's an object of my class Activity
ListField list = new ListField(6);
add(list);


}
}
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Add items to ListField and create Events

How have you added the elements to this ListField and how do you paint them? 

 

I'd like a full (but small) sample, as then all the parts can be explained. 

Contributor
Posts: 22
Registered: ‎03-19-2013
My Device: curve
My Carrier: iam

Re: Add items to ListField and create Events

this is my probleme i do not know how to add element to my listfield
Developer
Posts: 228
Registered: ‎10-01-2011
My Device: Passport

Re: Add items to ListField and create Events

[ Edited ]

Just subclass ListField and add a funciton to add an item. Alternatively as Peter said just add a new listfield with the new list in it.