×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Nov 2013
    Posts
    8

    LIST ITEM FOR httpconnection

    Hi,
    I have succesfully wriiten http response to a stringbuffer and stringitem.I want to split the string to display each line in a list row. How can I achieve that?

    StringItem resultField = new StringItem(null, description,Item.HYPERLINK);
    // StringItem resultField2 = new StringItem(null, results2.toString(),Item.HYPERLINK);
    form.append(resultField);

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    608

    Re: LIST ITEM FOR httpconnection

    what your asking is basically a way to split the string into string array for each line?
    while j2me doesnt suppport the String.split method you can write your own.
    Here is mine
    public static String[] StringSplit(String text, String del) {
    Vector v = new Vector();
    int pos;
    while ((pos = text.indexOf(del)) >= 0) {
    v.addElement(text.substring(0, pos));
    text = text.substring(pos + del.length());
    }
    if (!text.equals(""))
    v.addElement(text);
    String[] ret = new String[v.size()];
    v.copyInto(ret);
    return ret;
    }
    Feel free to use it.
    depending how your new line is format you may have to call it with "\n" or "\r\n" as the del (short for delimeter) parameter

  3. #3
    Registered User
    Join Date
    Nov 2013
    Posts
    8

    Re: LIST ITEM FOR httpconnection

    Hi,
    I get the following error when I try it,

    Detail formatter error:java.util.Arrays cannot be resolved to a type.

  4. #4
    Registered User
    Join Date
    Nov 2013
    Posts
    8

    Re: LIST ITEM FOR httpconnection

    It seems the array class is not supported in j2me.Can anyone get me sample code that displays http response in a list item with more than one row?

  5. #5
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    608

    Re: LIST ITEM FOR httpconnection

    Hmm my code sample didnt use "Arrays" class
    u should tried it again.

  6. #6
    Registered User
    Join Date
    Nov 2013
    Posts
    8

    Re: LIST ITEM FOR httpconnection

    This is the error I get "Detail formatter error:java.util.Arrays cannot be resolved to a type."

  7. #7
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    608

    Re: LIST ITEM FOR httpconnection

    Is that an error that comes from eclipse?
    Is that error is shown while you run your app?
    have you tried to clean the project and re-build it?
    does it gives you the line number in which the error is?
    you need to provide us with more details so we can help you better.

    Out of the top of my head it seems that your eclipse code formating configuration has some problems with your code, make sure that if you copied the code i wrote below that you didnt insert any unknown characters.
    Heard of DVLUP? Join here

  8. #8
    Registered User
    Join Date
    Nov 2013
    Posts
    8

    Re: LIST ITEM FOR httpconnection

    Hi Shai,

    It worked.The was during debugging but its not affecting the operation.

    Thanks a bunch

Similar Threads

  1. Add item list box when click a item!
    By khanhcoc1210 in forum Symbian User Interface
    Replies: 3
    Last Post: 2012-02-10, 08:19
  2. QML List (Horizontal list) - flick to highlight next item
    By brian.egan in forum [Archived] Qt Quick
    Replies: 1
    Last Post: 2011-09-23, 13:19
  3. Disable a prticular item in my Setting Item list
    By TAHIR in forum Symbian User Interface
    Replies: 2
    Last Post: 2010-03-16, 05:26
  4. Replies: 4
    Last Post: 2009-02-17, 21:24
  5. Replies: 6
    Last Post: 2009-01-08, 13:06

Posting Permissions

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