hi all,
i'm developing a j2me application that can send and receive messages, but i don't know how to select multiple contacts from phonebook. Can anyone pls help me. Its urgent.

Thanks in advance

8 Years
Discussion Span
Last Post by deathknell

Can you showcase how you do single selection in first place so we do not break your current flow in application and just build on it.

PS: Your urgency mean nothing to us, we help when we can not when somebody demands it...



in this case I can send a message using sms and also can read and write phonebook in memory device.

Now I want to select one or some contact in my list of phone book and send it or them to another number via sms.

Could you tell me the syntact so that I can do that?



@Peter :
Forgive me, I'm really forget to tell you about the way to actually displaying these contacts.

I'm display the contact that stored in memory device, not in SIM card.


Because too many class, so that I upload my script at internet.
Here is the URL :

Its application ( I named it BUPBClient) can read-write phonebook, select contact in phonebook list (that stored in memory device, not in SIM card) in 1 contact, 5 contacts, and all contacts ( I assume 100 entry for all contacts).

But it can't send contact/s that selected via SMS to another number (destination number).

I've try it (you can see in my script) but it show error message "null" for every field of contact that I want to send ( in this case I use one contact).

Hope you help me. You can use Eclipse Pulsar, J2ME WTK22 emulator (or higher version), or Netbeans to run my J2ME application.

Need your help please.
Sorry for illiterate you.



Can you check the uploaded code because there is error on compile from ListSelectionSelected line 173

screen = new ItemDisplayScreen(this.midlet, this, this.listType, this.list, asa, j);

Class ItemDisplayScreen has only this constructor

public ItemDisplayScreen(BUPBClient midlet, ItemSelectionScreen caller, int listType, PIMList list, int asa, int asi)

Hi Peter,

Sorry , that is my mistake. It should be not include that class (ListSelectionSelected) in it.

Now, the new BUPBClient script can be download in this URL :

1. I've change language in Indonesia to English
2.Some contact (in vcf file).
3. Read me file to store contact (path location) and run this application.
4. I modify script from Nokia community (see at script) and still in GNU/GPL.

My problem still :
"Why it show error message 'null' when I select one or some contact and send it/them to destination number?"

Need your help please.


Sorry for the mistake.


I've try and now my script can show all field of each contact (before they send) according to couint fo select (select 1, select 5, and select all).

But now, how to call DMC class (compress method) so that I can compress some contact that selected 9and store them into tmp) then send it to destination number using sms?

In my script I put some line that call DMC class (and 2 class that related), but I didn't know to get value of all field of each contact that selected, so that I can compress them. :(

Need your help please.


I'm at work at the moment and cannot provide full answer, by your problem is in data consistency handling. Class A collect list index selected pass next class that try to locate PIM detail related to this number and then again you passing selection number. Be consistent either pass along unique ID of PIM contact or pass along PIM object which hold selected contact


Thanks for your help Peter :)

Here new code by me :

Forgive me for the late, I've try it before by myself and still error when call DMC for compress some contact that selected and send them via sms to destnation number :(

Last, I comment the line below :
//SMSSend sms=new SMSSend(nama);
//SMSSend sms = new SMSSend(a);
(at class CompressAndSend.java)

So that, if you run my script (for example in Eclipse), and click "send", it only show compressed file in it, can't send them via sms to destination number.

I've also change some word at my script from Indonesian language to English, so that you and another person here can understand it (and can help me to solve this problem).

Thanks for the help.



I'm sorry dude but day has only 24 hours and there are only 7 days in week. Out of this time I spend most at work, plus there is some personal study and quality time with girlfriend and only after this comes sleep and daniweb.

Secondly reading someone else code is time consuming specially if code is not well organized and there is no chance of face to face interaction.

To start I give you task to perform. Your GUI handling (moving from screen to screen view) is very bad and is building on each other. To accomplish simple move from one screen to another only thing you need to pass is instance of Display screen, which I seeing in your code is done badly, example:

public void startApp() {
    Display.getDisplay(this).setCurrent(new ListTypeSelectionScreen(this));

ListTypeSelectionScreen(this) is effectively passing instance of whole MIDlet and its get even more messy with classes to follow after it.

Displayable screen = new ListSelectionScreen(midlet,ListTypeSelectionScreen.this, listType);

Here beside forwarding MIDlet instance you even forward of current screen. What for????

Check this code, above issue can be done with simple passing instance of Display

import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.Display;

public class GetDisplay extends MIDlet{

    private Display dis;

    public GetDisplay(){


    public void startApp(){
        if(dis == null){
            dis = Display.getDisplay(this);
        dis.setCurrent(new NextScreen(dis));

    public void pauseApp(){}

    public void destroyApp(boolean unconditional){}
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.StringItem;
import javax.microedition.lcdui.TextField;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Displayable;

public class NextScreen extends Form implements CommandListener{

    private Display dis;
    private Command next;

    public NextScreen(Display dis){
        super("Next Screen");
        this.dis = dis;

    private void init(){
        StringBuffer str = new StringBuffer();
        for(int i = 0; i < 10; i++){
            str.append("My ver, very long string ");
        StringItem si = new StringItem(null, str.toString());

        TextField tf = new TextField("My Label", "", 25, TextField.ANY);

        next = new Command("Next", Command.SCREEN, 0);

    public void commandAction(Command c, Displayable d){
        if(c == next){
            dis.setCurrent(new LastScreen(dis));
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.StringItem;

public class LastScreen extends Form{

    public LastScreen(Display dis){
        super("Last Screen");

    private void init(){
        StringItem si = new StringItem("", "My Last Screen");

There are better approaches, but without you having better understanding of JME there is no point in explaining as I will make you even more confused.

Please adjust your screen handling based on my example and in mean time I will have look on PIM handling.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.