×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    153

    please help ,how to add items in list view in lwuit

    hello,I am working on S40 using sdk2.0 and lwuit 1.5.so now I need list view and I want click event on each cell of of list view .I am sending a snapshot of image
    http://imgur.com/TpLzzx7. I want to same view of list separated by line and looking separate cell. please send me the link of tutorial of list view as I told about you. please I am very needy of this thing help me please

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: please help ,how to add items in list view in lwuit

    Hello,

    You need to write your own ListCellRenderer for achieving this. This should be very straight forward, extend your cell renderer from component or container , override the paint method code from drawing string and then line beneath it.

    And fill your cell renderer from your Model.

    This link will give you some more details http://developer.nokia.com/Resources...renderers.html

    Regards,

  3. #3
    Registered User
    Join Date
    May 2013
    Posts
    153

    Re: please help ,how to add items in list view in lwuit

    I used the ListCellRenderer but when I call by the list object
    List list=new List()
    list.setListCellRenderer(new listcellrenderer);
    this mehod show deprecated.so please tell me how to use this ListCellRenderer .send me tutorial or link of any complete program I am needy

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: please help ,how to add items in list view in lwuit

    you need to use the setRenderer method instead of setListCellRenderer !!

  5. #5
    Registered User
    Join Date
    May 2013
    Posts
    153

    Re: please help ,how to add items in list view in lwuit

    sir I tried as my best but my code was not got success please give ma a single example in a single midlet class in which show the two listcell not more .please send me the link. my implemented code is give below
    Code:
    import java.io.IOException;
    
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;
    
    import com.sun.lwuit.Button;
    import com.sun.lwuit.Component;
    import com.sun.lwuit.Display;
    import com.sun.lwuit.Form;
    import com.sun.lwuit.Image;
    import com.sun.lwuit.Label;
    import com.sun.lwuit.List;
    import com.sun.lwuit.events.ActionEvent;
    import com.sun.lwuit.events.ActionListener;
    import com.sun.lwuit.list.ListCellRenderer;
    import com.sun.lwuit.plaf.Border;
    
    
    public class listcell extends MIDlet implements ListCellRenderer{
    public Form form;
    private Image[] images;
    public List l;
    	public listcell() {
    		// TODO Auto-generated constructor stub
    	}
    
    	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
    		// TODO Auto-generated method stub
    
    	}
    
    	protected void pauseApp() {
    		// TODO Auto-generated method stub
    
    	}
    
    	protected void startApp() throws MIDletStateChangeException {
    		// TODO Auto-generated method stub
    		Display.init(this);
    		form=new Form();
    		
    		 images = new Image[2];
    	        try {
    	            images[0] = Image.createImage("/sms.png");
    	            images[1] = Image.createImage("/facebook.png");
    	        } catch (IOException ex) {
    	            ex.printStackTrace();
    	        }
    	        l=new List();
    	        l.setRenderer(this);
    	        form.addComponent(l);
    	        form.show();
    		
    
    	}
    
    	public Component getListCellRendererComponent(List list, Object value, int index, boolean isSelected){
    	       Label l = new Label(value.toString());
    	if (isSelected) {
    	              l.setFocus(true);
    	              l.getStyle().setBgTransparency(100);
    	          } else {
    	              l.setFocus(false);
    	              l.getStyle().setBgTransparency(0);
    	         }
    	         return l;
    	}    public Component getListFocusComponent(List list){
    	       return null;
    	}
    
    }

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: please help ,how to add items in list view in lwuit

    i can see lots of mistake in your class.

    1. i would recommend to extend your cell renderer class from a component not a midlet.
    2. in getListCellRendererComponent cast the value object to your model object and then fill your component from that model object !!

    Then this should work !!

Similar Threads

  1. 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
  2. how to make it list view using lwuit
    By murugacse4 in forum Mobile Java General
    Replies: 5
    Last Post: 2011-06-30, 08:11
  3. Replies: 0
    Last Post: 2011-04-06, 08:05
  4. MTM: custom menu items in Message list view
    By alphaMail in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2008-08-14, 13:37
  5. Custom List doesn't view all list items...
    By dusanbaranec in forum Mobile Java General
    Replies: 2
    Last Post: 2005-06-09, 03:10

Posting Permissions

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