Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Developer
Posts: 92
Registered: ‎01-23-2009
My Device: Z10
My Carrier: klarmobil

SystemToast not going away

I followed the example about showing up a toast in the C++ way (not qml)

 

new SystemToast(this);
setPosition(SystemUiPosition::BottomCenter);
setBody("...");
show();

 

but it does not go away but appear over and over again. Whats wrong with it?

Developer
Posts: 31
Registered: ‎03-06-2011
My Device: Not Specified

Re: SystemToast not going away

[ Edited ]

How are you calling it? I have a function in my app that is just like:

void MyApp::toastString(const QString str){
    bb::system::SystemToast *toast = new bb::system::SystemToast(this);
    toast->setBody(str);
    toast->show();
}

 
and it shows for just a short time after being called. Does it still repeat if you remove the position line?

Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: SystemToast not going away

insert a debug() line to see if you're calling more then one time

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
New Developer
Posts: 92
Registered: ‎01-23-2009
My Device: Z10
My Carrier: klarmobil

Re: SystemToast not going away

I'm calling it like you. But even without the positioning line its still becomes a pulsating toast for me. (I'm on 10.0.9.1673 by the way)
New Developer
Posts: 92
Registered: ‎01-23-2009
My Device: Z10
My Carrier: klarmobil

Re: SystemToast not going away

I have set a breakpoint at first as I encountered this but I'm not arriving there more than once.
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: SystemToast not going away

my code is similar and works well

mToast = new SystemToast(this);
mToast->setPosition(SystemUiPosition::BottomCenter);
mToast->setBody(tr("Synchronization with Server done :)"));
mToast->setIcon(QUrl("asset:///images/online-icon.png"));
mToast->show();

 

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: SystemToast not going away

Are you updating the contents of the toast somewhere else in your code?
-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: SystemToast not going away


zezke wrote:
Are you updating the contents of the toast somewhere else in your code?

you mean while it is shown ?

No

 

I'm using SystemProgressDialog where I want to show progress and update content like text, icon, state...

 

because I have no control how long a toast is displayed I don't update content while showing

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: SystemToast not going away

I was talking to the topic starter actually, you know the guy with the problem;-)
-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Developer
Posts: 293
Registered: ‎10-15-2012
My Device: bb10 developer
My Carrier: Orange

Re: SystemToast not going away

I noticed a similar problem with SystemToast - I believe its a bug that causes the toast to continually display itself. 

 

The only workaround I found was to create the toast once (when my app starts), and then keep reusing the same toast whenever you want to display your message. i.e. only call "new SystemToast" once, and keep a pointer to it in your application instance