언어 설정

Menu
Sites
Language
Thread and UI Framework

Hi everybody.

I've started work with tizen native for 2 weeks, please help me: I have a thread, in Run() I call sleep( 2 ) ( sleep 2 seconds) and then I change UI Form with SendUserEvent method. Problem is new Form is not appear util I click to screen ( it doesn't have problem if I donot call sleep).

Sorry because of my bad English.

Responses

4 댓글
Alex Ashirov

Hi,

It’s not clear enough what the thread does. As far as I understand you use sleep()  with the thread in order to implement timer. If so, then probably it could be better to use Tizen::Base::Runtime::Timer class inside the same thread.

Tuan Anh

Hi,

In run():

Object*
SplashThread::Run(void)
{
    sleep(2);

    if(pFormMsg != null) {

        pFormMsg->SendUserEvent(1 , null);
        AppLog("Change to next form");
    }

    return null;
}

Then, in OnUserEventReceivedN method of FormMsg (FormMsg is a custom control I added to current form):

void
FormMsg::OnUserEventReceivedN (long requestId,Tizen::Base::Collection::IList * pArgs) {
    AppLog("Change Form");
    SceneManager* pSceneManager = SceneManager::GetInstance();
    AppAssert(pSceneManager);
    pSceneManager->GoForward(ForwardSceneTransition(MainForm, SCENE_TRANSITION_ANIMATION_TYPE_LEFT) , null);
    AppLog("Change Form Success");
}

I want to wait 2 seconds before change to next Form. Is that any other idea to do that task?

Alex Ashirov

Hi,

You definitely need to use time instead of the thread here. General steps you need to do:

Inherit your FormMsg class from ITimerEventListener interface;

Add new member into FormMsg class:

Timer __timer;

Call __timer.Start(2000); from the place there you currently start the thread;

Implement virtual OnTimerExpired (Timer &timer) method of the ITimerEventListener interface and use it instead of OnUserEventReceivedN;

Tuan Anh

Thank Alex Ashirov. It works for me :D