Solved

J2ME lcdui.List problem

Posted on 2003-12-01
6
427 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 200 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

623 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