Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

J2ME lcdui.List problem

Posted on 2003-12-01
6
Medium Priority
?
435 Views
Last Modified: 2013-11-23
I'm trying to build my application with the WTK2, but I'm always getting the following error message:

C:\WTK20\apps\Client\src\WVClient.java:413: cannot resolve symbol
symbol  : constructor List (java.lang.String,int,java.lang.String,<nulltype>)
location: class javax.microedition.lcdui.List
      NameSearchList = new List ("Name Search", List.IMPLICIT, resultSearch[0], null);

I can't find what's wrong with the List. I'm pasting below all the parts of this class that seem relevant for me.

import javax.microedition.lcdui.*;      // Command, Textfield, Form
import javax.microedition.midlet.*;      // MIDlet
import java.util.*;

...

private List NameSearchList;

...

private String phoneBookSearch;
private String[] resultSearch;
int busca;      // Usada para guardar o valor para uma nova busca de nome ou telefone

...

/**
 * Responsible for starting the name search
 */
public void setGetNameSearchList() {

      inputForm = new Form(null);
      TFitem1 = new TextField("Name", phoneBookSearch, 40, TextField.ANY);
      Ticker titulo = new Ticker ("NameSearch");
      inputForm.setTicker(titulo);
      inputForm.append(TFitem1);
      inputForm.addCommand(cancel);
      inputForm.addCommand(submit);
      inputForm.setCommandListener(this);
}

...

// "SetGetNameSearchList"
      case 5:
            NameSearch nameSearch = new NameSearch(con);
            busca = 1;
            resultSearch = nameSearch.getNameRequest(phoneBookSearch);
            NameSearchList = new List ("Name Search", List.IMPLICIT, resultSearch[0], null);
            NameSearchList.addCommand(cancel);
            NameSearchList.addCommand(newSearch);
            NameSearchList.setCommandListener(WVClient.this);
            display.setCurrent(NameSearchList);
            break;
...

Where NameSearch is another class I'm developing and the name of the current class is WVClient. If any other information is needed, please contact me.

0
Comment
Question by:mdytz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 9850077
> symbol  : constructor List (java.lang.String,int,java.lang.String,<nulltype>)

  You are trying to create a List object by passing different number or types of arguments in the constructor... Can you post some docs about the "List" object or some source code if you have?
0
 
LVL 35

Accepted Solution

by:
girionis earned 800 total points
ID: 9850095
 Look here: http://j2medevices.com/documentation/midp1.0/javax/microedition/lcdui/List.html

  There are two types of constructors:

List(String title,  int listType)
          Creates a new, empty List, specifying its title and the type of the list.

List(String title, int listType, String[] stringElements, Image[] imageElements)
          Creates a new List, specifying its title, the type of the List, and an array of Strings and Images to be used as its initial contents.

   You need to change this:

NameSearchList = new List ("Name Search", List.IMPLICIT, resultSearch[0], null);

  to something that fits the constructors above. You probably want to use the second constructor but you are trying to pass an element as the third parameter instead of the array itself.

NameSearchList = new List ("Name Search", List.IMPLICIT, resultSearch[0], null);

  should probably be

NameSearchList = new List ("Name Search", List.IMPLICIT, resultSearch, null);

  in order to compile.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9850451
Yes.  Just drop the [0] from the resultSearch parameter.  The constructor needs an array of Strings.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 15

Expert Comment

by:jimmack
ID: 9850461
Just in case you need to, you are not doing a display.setCurrent() in setGetNameSearchList().
0
 

Author Comment

by:mdytz
ID: 9851303
It compiled, thank you for your help !!!
0
 
LVL 35

Expert Comment

by:girionis
ID: 9853442
:)
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question