BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 07-17-2008, 01:47 PM   #1
Aiwa
Thumbs Must Hurt
 
Join Date: Jul 2008
Model: 7100T
PIN: N/A
Carrier: Programmer
Posts: 50
Default ListField problem

Please Login to Remove!

Hello...
i've been trying to undserstand how the ListField works...
i'm stating from the loading side, instead of the saving side...which i now sound kinda crazy, but that's the way it has to be...
So i'm trying to load the ListFrield like...
Code:
ListField n = new ListField();
now how do i make n be the lsit field i wanted?
like...to search this place to see how many item are there now etc etc
so that after this code when i typed:
Code:
n.getSize();
it would appear exacly the number of "names" i saved....
Offline  
Old 07-17-2008, 02:21 PM   #2
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

I'm having a hard time finding a specific question here. Can you tell us what you are trying to accomplish?

My suggestion is to look at ObjectChoiceField first, this is somewhat more straight-forward to implement and will probably handle your task.
Offline  
Old 07-17-2008, 02:36 PM   #3
Aiwa
Thumbs Must Hurt
 
Join Date: Jul 2008
Model: 7100T
PIN: N/A
Carrier: Programmer
Posts: 50
Default

well
i'm trying to load a list of names...
but what do i have to load? like...an ID? a name?
and how do a actually load it using the ListField?
Offline  
Old 07-17-2008, 02:55 PM   #4
Aiwa
Thumbs Must Hurt
 
Join Date: Jul 2008
Model: 7100T
PIN: N/A
Carrier: Programmer
Posts: 50
Default

anyway...what i wanna do is to have like a second phonebook
but this one, the person on the phone doesn't have control...
who has control are ohter people and they'll controll it from a computer, or another phone
in other post someone gave me the idea to send the data for that in an email...and that should do...
it would be...someone sends an email to a phone, and this person's phone is going to recognize the email even before it show on the screen, because this program is going to have a filter for the emails that start with a certain code(which an normal email is never going to start like)...
this email is going to be something like:
!@#$%!$#@!$@#$@!#-NAME-1234567
So basically the phone would recognize the !@#$%!$#@!$@#$@!#-...so it would save whatever comes after the - and before the next -...as the Name of hte person and then it would save whatever comes after the - as the number...

so basically this app would open and load all the names that it saved ever
so i think it would save in some kind of ID
so the ListField would have to load this ID
this is my question, how do i load it?
Offline  
Old 07-17-2008, 04:40 PM   #5
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

What happens to the items in the list, once the list is loaded? Does the user select an item from the list?

As a general answer to your question, you would retrieve the list of items from your datastore (as an array of some Object), then pass this list to the ListField.

For example: create an instance of ObjectListField(), then use insert() to add the individual list elements from your data.

You must create a Screen (I suggest subclassing MainScreen), then add your ObjectListField to the Screen using the method add().

All of this is documented in the API reference, and there are numerous examples on the Developers web site.
Offline  
Old 07-17-2008, 04:47 PM   #6
Aiwa
Thumbs Must Hurt
 
Join Date: Jul 2008
Model: 7100T
PIN: N/A
Carrier: Programmer
Posts: 50
Default

ok...you're explanation was pretty much what i needed i think
but i'll only be able to test it tomorrow, because my debugger is not working for some weird reson and i'm about to go home


but answering your question...once the list is loaded, i wanted to list on the screen all the names that it found...if there are no names it would appear as *empty* like the default of the bb
Offline  
Old 07-18-2008, 09:03 AM   #7
Aiwa
Thumbs Must Hurt
 
Join Date: Jul 2008
Model: 7100T
PIN: N/A
Carrier: Programmer
Posts: 50
Default

Quote:
Originally Posted by Dougsg38p View Post
What happens to the items in the list, once the list is loaded? Does the user select an item from the list?

As a general answer to your question, you would retrieve the list of items from your datastore (as an array of some Object), then pass this list to the ListField.

For example: create an instance of ObjectListField(), then use insert() to add the individual list elements from your data.

You must create a Screen (I suggest subclassing MainScreen), then add your ObjectListField to the Screen using the method add().

All of this is documented in the API reference, and there are numerous examples on the Developers web site.
ok...
the part of adding the ObjectListField to the Screen i understand
but again...how am i going to load the ListField onthe ObjectListField?
let's say, this second phone book is saved on the id: 0xf06c2b5d95e704c8L.

can you be more specific on how am i going to load it, like using actual codes?
Offline  
Old 07-18-2008, 10:22 AM   #8
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

How are you storing the list in the datastore? Whatever it is, you'll use some container to hold the actual data: example a Vector, HashTable, etc.

I typically use a hashtable. The table is stored in a PersistentStore. You really need to read up on the use of PersistentStore. This allows you to store an Object in the device storage.

Once you have this working, you will simply retrieve the container object from the store, retreive the contents of the container (using whatever is the appropriate method for that container), and then insert() the list items into the ObjectListField.

If you look at your sample programs that came with the JDE, you will find several examples of this. There are also several articles in the Blackberry Developer Knowledgebase on the subject.
Offline  
Old 07-18-2008, 10:30 AM   #9
Aiwa
Thumbs Must Hurt
 
Join Date: Jul 2008
Model: 7100T
PIN: N/A
Carrier: Programmer
Posts: 50
Default

yea
i was actually thinking about using the vector
but Hashtable sounds easier :S

but well...i can't even mess with the saving part right now because i have to fill up the socket part, cause it's only going to save when it receives some find of "email"...and i still don't have this app. but i can start on the loading part, that comes whenever the guy start the app...
But i'm still kidna confusing on how to use to load, if i save using the vector
i already read some about PersistenObject...and i know it's going to save in some kind of Long ID. but how am i going to load using the ListField, from this ID.

And i've seen a lot of those samples, but most don't explain that
i found the Contact, and that would be the most similar to my app, but it still using a bunch of classes i can't find about, or takes me an hour to find out that the class is already created in another file on the sample folder...
my app particularly don't need that many classes i THINK. the basic ones should do, because it's a metter of, save, load, and show and no more then that
and the save would have only "name" and "number" linked to each other...
so it's not like the contact table that has number, email, cellphone number, about etc etc
Offline  
Old 07-18-2008, 01:39 PM   #10
PaoloLim
New Member
 
Join Date: Jun 2008
Model: 7290
PIN: N/A
Carrier: Cingular
Posts: 14
Default

I suppose you can create your own Contact class if you feel that the provided ones are too complex for your specific project. It's not like your contact list will be interacting much with the native one from what I've read.

As for loading into your ObjectListField, once you recover your datastructure from the PersistentStore, simply iterate through it and insert each object into the ObjectListField.
Offline  
Old 07-18-2008, 01:47 PM   #11
Aiwa
Thumbs Must Hurt
 
Join Date: Jul 2008
Model: 7100T
PIN: N/A
Carrier: Programmer
Posts: 50
Default

yea...i'm gonna try that and i'll post any news

and no, my contact list would not and CANT interact with the normal phonebook
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


SOFTROL PRESSURE TRANSDUCER E2-PSEN picture

SOFTROL PRESSURE TRANSDUCER E2-PSEN

$99.99



Load Controls Inc. Power Cell Transducer (TSC) picture

Load Controls Inc. Power Cell Transducer (TSC)

$74.99



CIVCO 610-1010 CIV-Flex Transducer Cover, 17.8 x 147 cm (24/Box) Exp 6/26 picture

CIVCO 610-1010 CIV-Flex Transducer Cover, 17.8 x 147 cm (24/Box) Exp 6/26

$88.50



5V Pressure Transducer or Sender 30psi-1600Psi for Fuel Diesel Oil Air Water picture

5V Pressure Transducer or Sender 30psi-1600Psi for Fuel Diesel Oil Air Water

$25.43



5V Fuel Pressure Transducer 100/150/200/300/500/1000/1600Psi for Oil Air Water picture

5V Fuel Pressure Transducer 100/150/200/300/500/1000/1600Psi for Oil Air Water

$22.78



CR Magnetic CR4180-20 True RMS AC Current Transducer 3 Element - New picture

CR Magnetic CR4180-20 True RMS AC Current Transducer 3 Element - New

$199.95







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.