Splash screen without duration ...

8 messages - 2429 views

Hello !

I'm trying to find a way to display a splashscreen while my midlet is sending data to a server (via a webservice call).  Actually I would like to know how I can display a splashscreen which would remain visible unless a method is called or an event is sent. So I'll juste have to do so after the end of the transfer.

If somebody has a hint for me ;)

Thanks

Hi,

You can retrieve the instance of your splash using splash() method like this :

popubox = MyKuixMidlet.getDefault().splash(-1, content, onCloseAction);

 

And then use this when you want to remove it and free up his ressources :

popupbox.remove();

Hey again Luciole !

Thanks that's exactly what I was searching for. I'll try this in the afternoon but I think it'll be ok !

 

so, thanks again ;)

Actually I tried the same with showPopupBox(...) method, but I doesn't work. The popup is only displayed when the client -> server's communication is done and I really can't find why... I also tried to call Main.getDefault().getCanvas().repaint() just after the showPopupBox(...) but nothing changed ... Strangeness of computing ...

I really can't manage to display my popup or splashbox, perform a client->server task and then close the box.

I tried it different ways but no matter what I do, the splash is always briefly displayed once the method which communicates with the server ends and never the way I want.

Any help would be welcomed ...

Do you put you client-server logic in a thread ?

Else if you did it in the worker thread, repaint could be blocked.

No I don't, it's in the main thread. However, i tried to display my splash launching a separated thread and putting the thread.interrupt right after my "sendToServer" method. Anyway, I still need to wait after the end of the "sendToServer" method to see my splash...

Any idea to fix this ?

(I know this is a very old thread, but I found it using Google, without an answer. Maybe this post can be of service to others.)

At first it didn't work for me (same problem as fjrtaine: no repaint), but now I solved it. I'm not sure what you're doing exactly, fjritaine, but here's how I do it: I just display the splash in the main thread (in the onAdded method of my Frame, actually), and I launch the necessary actions in a separate thread.

Here's the relevant part of my code (in onAdded():

splashBox = Kuix.splash(-1, splashWidget, "splashClosedMessage");
screen = Kuix.loadScreen("main.xml", null);
screen.setCurrent();
new Thread(myRunnable).start();

In the run() method of myRunnable, I then call splashBox.remove() (after setting splashBox.cleanUpWhenRemoved to true).