Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6925577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:48:26+00:00 2026-05-27T10:48:26+00:00

I have a list that contains about 20 image URLs and some other things.

  • 0

I have a list that contains about 20 image URLs and some other things.

I want to display the other things (description) and allow the user to interact with the app while I load the 20 images.

What I noticed is that no matter what I tried, I can’t interact with the form until the images finished loading even though I am doing the loading in another thread.

This is my solution I am using now.

private Container createServerItems() throws Exception {
    Container list = new Container(new BoxLayout(BoxLayout.Y_AXIS));

    final int size = mediaList.size();

    final Button buttons[] = new Button[size];

    System.out.println("In here: " + size);
    for (int i = 0; i < size; i++) {
        Container mainContainer = new Container(new BorderLayout());
        Media m = new Media();
        m.fromJSONString(mediaList.elementAt(i).toString());

        buttons[i] = new Button("please wait");

        final int whichButton = i;
        Display.getInstance().callSerially(new Runnable() {

            public void run() {
                try {
                    System.out.println(MStrings.replaceAll(m.getImgURL(), "\"", ""));
                    final StreamConnection streamConnection = (StreamConnection) Connector.open(MStrings.replaceAll(m.getImgURL(), "\"", ""));                        
                    Image image = Image.createImage(streamConnection.openInputStream());
                    streamConnection.close();

                    buttons[whichButton].setText("");
                    buttons[whichButton].setIcon(image.scaled(32, 32));

                } catch (Exception e) {
                }
            }
        });
        TextArea t = new TextArea(m.getDesc());
        t.setEditable(false);
        t.setFocusable(false);
        t.setGrowByContent(true);

        mainContainer.addComponent(BorderLayout.WEST, buttons[i]);
        mainContainer.addComponent(BorderLayout.CENTER, t);

        list.addComponent(mainContainer);
    }
    return list;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:48:27+00:00Added an answer on May 27, 2026 at 10:48 am

    APPROACH I : LWUIT 1.5 has a powerful LWUIT4IO library to address your problem.

    An excerpt from Shai’s Blog link

    A feature in LWUIT4IO to which I didn’t give enough spotlight is the
    cache map, its effectively a lean hashtable which stores its data
    using weak/soft references (depending on the platform) and falls back
    to storage when not enough memory is available. Its a great way to
    cache data without going overboard. One of the cool things about it is
    the fact that we use it seamlessly for our storage abstraction (which
    hides RMS or equivalent services) in effect providing faster access to
    RMS storage which is often slow on devices.

    Another useful link is here

    The idea is to delegate the Network IO functionality to a singleton to avoid any UI deadlocks, like the one you are facing.

    A very good video demo here by vprise, explains how to bind GUI functionality to your netbeans. In this video at around 7:00 mins it explains the use of ImageDownloadService class which binds the component to its thumbnail url which will seamlessly fetch from the network and populate the Image.

    APPROACH II: Difficult one of create custom logic

    1. Create a singleton that will interface with the network to fetch the
      data
    2. Use a queue to handle the sequential image download services
    3. Create a new thread for this singleton and wait on the queue.
    4. With each image download service bind a listener with the invoking
      component so that it easier to update the right component.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PersonEditorModel that contains a list of people that I want represented
I have a .txt file that contains a list of names and some numbers.
I have a table that contains some user data: user_id | guest_id | time_seen
I have a query that contains about 10 joins. Using a List View and
I have a list that contains 10**7 lists in the format: big_list = [[1,
I have a List that contains items, for example: 1) https:\\10.12.23\\ 2) https:\\12.23.12.25\\ 3)
I have a list box control that contains enough items to list them with
I have been trying to serialize a list that contains arrays and lists. I
I have a Silverlight 2.0 DataGrid that contains a list of items that needs
I have a div that contains a list of messages (it's a chatroom application).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.