Solved

J2ME lcdui.List problem

Posted on 2003-12-01
6
377 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
  • 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
countPairs challenge 7 58
wordappend challenge 8 85
get weblogic logged in user in java 2 43
eclipse formatting 6 43
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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

760 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now