Discussion Board

Results 1 to 8 of 8

Thread: Lwuit list View

  1. #1
    Registered User
    Join Date
    Jul 2014
    Posts
    3

    Lwuit list View

    hi i am newbe in nokia asha,
    how to display listview in category bar ansd form ;
    how can i get Lwuit .jar files ,
    which library had addcomponent () function

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,798

    Re: Lwuit list View

    Hi, if you install an Asha SDK, it contains the LWUIT libraries already. Here is a getting started guide describing configuration steps for Eclipse and NetBeans: http://developer.nokia.com/resources...g-started.html
    For lists in particular, you may find this Wiki article useful: http://developer.nokia.com/community...ing_LWUIT_List

  3. #3
    Registered User
    Join Date
    Jul 2014
    Posts
    3

    Re: Lwuit list View

    i am using the import com.sun.lwuit.Component library, but addcomponent() is not display in my eclipse

  4. #4
    Registered User
    Join Date
    Jul 2014
    Posts
    3

    Re: Lwuit list View

    hi can you help me display listview in form,

    i m tried this code

    Form form = new Form();
    form.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

    radioButtonGroup = new ButtonGroup();

    for (int i = 0; i < 10; i++) {
    RadioButton radioButton = new RadioButton(“List item ” + (i + 1));
    radioButton.setUIID("ListItem");
    radioButtonGroup.add(radioButton);
    form.addComponent(radioButton);//i had error : the error:The method addComponent(List) is undefined for the type Form

    radioButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
    // Code for handling the list selection
    }
    });
    }

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,798

    Re: Lwuit list View

    Make sure that the code uses com.sun.lwuit.Form and List.
    Because Form and List controls are also available for LCDUI (javax.microedition.lcdui.Form and List), and that will not work.

  6. #6
    Registered User
    Join Date
    Apr 2012
    Posts
    13

    Re: Lwuit list View

    Hi, Thank you for asking please. Try out this source code.
    You will find some errors of XML, ignore the xml by commenting them. Comment the errors you find except those that ask you to import LWUIT. If you find problems please ASK. In this example you will be able to also create your own form with a list, I hope this will help. Welcome to Nokia, We are here for you. since you are a newbe in Nokia Asha please keep asking and we shall gladly help.

    SOURCE CODE
    public class Midlet extends MIDlet implements ActionListener {

    public void startApp() {

    Display.init(this);

    Resources r;
    try {
    r = Resources.open("/swahili.res");
    //UIManager.getInstance().setThemeProps(r.getTheme("begin"));
    UIManager.getInstance().setThemeProps(r.getTheme(r.getThemeResourceNames()[0]));
    } catch (IOException io) {
    io.printStackTrace();
    }

    Mainform();

    }

    public void Form2() {

    frm2 = new Form("MAIN MENU");
    //INSTANCIATING OF BUTTONS

    btnpark=new Button(" U G A N D A W I L D L I F E");

    btnculture = new Button("C U L T U R A L S I T E S");
    btnarcheology = new Button("A R C H E O L O G I C A L S I T E S ");
    btnactivity = new Button("A D V E N T U R E S");
    btnkla= new Button("K A M P A L A");
    btnEvents= new Button("E V E N T S");
    btnfee= new Button("P L A C E S O F W O R S H P");





    //instanciating for icon images
    com.sun.lwuit.Image g = null;//national park
    com.sun.lwuit.Image w = null;
    com.sun.lwuit.Image a = null;//cultural site
    com.sun.lwuit.Image b = null;//archeology
    com.sun.lwuit.Image c = null;//sport
    com.sun.lwuit.Image k = null;//kampala
    com.sun.lwuit.Image n = null;//fees



    try {

    g = com.sun.lwuit.Image.createImage("/icon.PNG");
    w = com.sun.lwuit.Image.createImage("/icon.PNG");
    a = com.sun.lwuit.Image.createImage("/icon.PNG");
    b = com.sun.lwuit.Image.createImage("/icon.PNG");
    c = com.sun.lwuit.Image.createImage("/icon.PNG");
    n= com.sun.lwuit.Image.createImage("/icon.PNG");
    k= com.sun.lwuit.Image.createImage("/icon.PNG");




    } catch (Exception e) {
    }



    btnpark.setIcon(g);
    btnEvents.setIcon(w);
    btnculture.setIcon(a);
    btnarcheology.setIcon(b);
    btnactivity.setIcon(c);
    btnkla.setIcon(k);
    btnfee.setIcon(n);



    Container ctntest2 = new Container(new BoxLayout(BoxLayout.Y_AXIS));

    ctntest2.addComponent(btnpark);
    ctntest2.addComponent(btnculture);
    ctntest2.addComponent(btnarcheology);
    ctntest2.addComponent(btnactivity);
    ctntest2.addComponent(btnkla);
    ctntest2.addComponent(btnEvents);
    ctntest2.addComponent(btnfee);




    btnpark.addActionListener(this);
    btnEvents.addActionListener(this);
    btnculture.addActionListener(this);
    btnarcheology.addActionListener(this);
    btnactivity.addActionListener(this);
    btnkla.addActionListener(this);
    btnfee.addActionListener(this);


    frm2.addComponent(ctntest2);
    frm2.show();

    frm2.addCommand(new Command("BACK")
    {
    public void actionPerformed(ActionEvent ae)
    {
    //calls destinat funionction
    frmmain.show();

    }
    });


    frm2.addCommand(new Command("Place First Advert")
    {
    public void actionPerformed(ActionEvent ae)
    {
    //calls destinat funionction
    //Advert1(); // Advert number 1(costs 200,000 Ug Shs).

    }
    });

    }

    public void actionPerformed(ActionEvent ae) {


    if (ae.getSource() == btn1) {
    AirUganda();
    //for archeological sites
    }

    else if(ae.getSource()==btnUg) {
    AutomotiveRoadside();
    }
    else if(ae.getSource()==Rbuton) {
    Form2();
    }
    //adverts
    else if(ae.getSource()==btnAir) {
    Form1();
    }

    NOTE:

  7. #7
    Registered User
    Join Date
    Apr 2012
    Posts
    13

    Re: Lwuit list View

    Or use Choice group, It can wrk as a List:
    public class EnglishApp extends MIDlet implements CommandListener,ItemStateListener {
    startApp(){
    switchDisplayable(null,B7());
    }
    public Form B7(){
    frm1 = new Form("Level 2");

    b7= new ChoiceGroup("Select Answer",Choice.EXCLUSIVE);

    b7.append("would",null);
    b7.append("use to",null);
    b7.append("used to",null);
    // b7.append("used",null);

    int defa;
    defa= b7.append("used",null);

    // Set the above choice as the initially selected option
    b7.setSelectedIndex(defa,true);

    frm1.append("7. It---to take us about six hours to drive to London.");
    int indexc;
    indexc= frm1.append(b7);
    frm1.addCommand(b2b6);//already implemented
    // frm1.addCommand(ans_q2);
    frm1.setCommandListener(this);
    frm1.setItemStateListener(this);

    return frm1;
    }


    public Form B8(){
    frm1 = new Form("Level 2");

    b8= new ChoiceGroup("Select Answer",Choice.EXCLUSIVE);

    b8.append("the",null);
    b8.append("--",null);
    b8.append("a",null);
    //b8.append("an",null);
    int defa;
    defa= b8.append("an",null);


    // Set the above choice as the initially selected option
    b8.setSelectedIndex(defa,true);

    frm1.append("8. Tony is a typical Cancer, he has----good memory.");
    int indexc;
    indexc= frm1.append(b8);
    frm1.addCommand(b2b7);//already implemented
    // frm1.addCommand(ans_q2);
    frm1.setCommandListener(this);
    frm1.setItemStateListener(this);

    return frm1;
    }

    public Form B9(){
    frm1 = new Form("Level 2");

    b9= new ChoiceGroup("Select Answer",Choice.EXCLUSIVE);

    b9.append("where they met? ",null);
    b9.append("where they met.",null);
    b9.append("where did they meet?",null);
    // b9.append("where had they met?",null);
    int defa;
    defa= b9.append("where had they met?",null);


    // Set the above choice as the initially selected option
    b9.setSelectedIndex(defa,true);

    frm1.append("9. Do you remember----");
    int indexc;
    indexc= frm1.append(b9);
    frm1.addCommand(b2b8);//already implemented
    // frm1.addCommand(ans_q2);
    frm1.setCommandListener(this);
    frm1.setItemStateListener(this);

    return frm1;
    }
    public void switchDisplayable(Alert alert, Displayable nextDisplayable) {
    // write pre-switch user code here
    display = Display.getDisplay(this);
    if (alert == null) {
    display.setCurrent(nextDisplayable);
    } else {
    display.setCurrent(alert, nextDisplayable);
    }

    }
    public Form tutorial(){

    frm1 = new Form("Tutorial");

    tutorList= new ChoiceGroup("",Choice.EXCLUSIVE);
    tutorList.append("What is Grammar",null);
    tutorList.append("The Capital letters",null);
    tutorList.append("Nouns",null);
    tutorList.append("Pronouns",null);
    tutorList.append("Adjectives",null);

    int defa;
    defa= tutorList.append("choose topic",null);

    // Set the above choice as the initially selected option
    tutorList.setSelectedIndex(defa,true);


    int indexc;
    indexc= frm1.append(tutorList);
    frm1.addCommand(back1);
    // frm1.addCommand(ans_q2);
    frm1.setCommandListener(this);
    frm1.setItemStateListener(this);

    return frm1;
    }


    //This method helps you so that your list reacts to events. ItemStateListener.
    public void itemStateChanged(Item item) {
    //the item is the choicegroup
    if(item==b7){
    if(b7.getSelectedIndex()==0){
    //response to success
    switchDisplayable(null,tutorial());
    }else if(b7.getSelectedIndex()==1){
    //this is just an example as we call the same method, create another method.
    switchDisplayable(null,tutorial());
    }
    //if u have another choice group called b8
    if(item==b8){
    if (b8.getSelectedIndex==0){
    //call another method
    }
    }
    Hope this is helpful.

  8. #8
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,798

    Re: Lwuit list View

    Why would you post these 2 code snippets here into this thread? A question about LWUIT list unlikely needs a ChoiceGroup example. Otherwise do not worry about XML issues, the code snippet refers nothing related to XML. This is just a tiny part of why I think your posts are not really helpful.

Similar Threads

  1. LWUIT list scrolling is slow whenever list cells contain long strings
    By lordbritishix1982 in forum Mobile Java UI and User Experience
    Replies: 1
    Last Post: 2013-12-03, 19:08
  2. please help ,how to add items in list view in lwuit
    By vikranttanwar@ in forum Mobile Java UI and User Experience
    Replies: 5
    Last Post: 2013-07-24, 06:13
  3. How to append LWUIT List screen to a LWUIT Form in j2me?
    By pavanragi in forum Mobile Java General
    Replies: 1
    Last Post: 2012-08-06, 07:01
  4. how to make it list view using lwuit
    By murugacse4 in forum Mobile Java General
    Replies: 5
    Last Post: 2011-06-30, 08:11
  5. Switching list view to Grid view for list box UIQ
    By brajabasi in forum Symbian User Interface
    Replies: 1
    Last Post: 2008-04-14, 07:30

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×