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
Super Contributor
Posts: 306
Registered: ‎08-10-2010
My Device: Not Specified

SetCover Image for the Application

Hi,

I want to set the cover image for my applicaiton. I tried using thumbnail() signla/slot mechanism. Slot is called when application went to minimize but image is not set there. I use the ScreenCover class to set the cover of the applicaiton.

 

I attached the source code for my applicaiton.

 

 

Developer
Posts: 71
Registered: ‎09-19-2012
My Device: Z10 very soon
My Carrier: Play

Re: SetCover Image for the Application

Hi

 

Why dont you use SceneCover like this ?

 

https://developer.blackberry.com/cascades/reference/bb__cascades__scenecover.html

 

 

using namespace ::bb::cascades;

class ActiveFrameCover : public SceneCover {
	Q_OBJECT
public:
	ActiveFrameCover();
	virtual ~ActiveFrameCover();

private slots:
	void update();

private:
	Container *mMainContainer;
	QmlDocument *qml;
};

 

#include "ActiveFrameCover.h"

ActiveFrameCover::ActiveFrameCover() :
		SceneCover(this) {

	qml = QmlDocument::create("asset:///ActiveFrameCover.qml").parent(this);
	mMainContainer = qml->createRootObject<Container>();
	setContent(mMainContainer);

	 
}

ActiveFrameCover::~ActiveFrameCover() {
	// TODO Auto-generated destructor stub
}

 

 

int main(int argc, char **argv)
{
    // Instantiate the main application constructor.
    Application app(argc, argv);

    ActiveFrameCover *pScenCover = new ActiveFrameCover();
    app.setCover(pScenCover);



    return Application::exec();
}

 

Developer
Posts: 71
Registered: ‎09-19-2012
My Device: Z10 very soon
My Carrier: Play

Re: SetCover Image for the Application

[ Edited ]

and also in bar-descriptor.xml you must set "Run when backgrounded" permission.   

 

You should also remember that

- SceneCover is refreshed very 30sec

- ScenceCover must be already created before you set it in your application

- you shouldn't use asych. calls e.g. Http requestes, DataModel's, Loading an image isn't good idea too

 

Create ScenveCover and then set the cover for your aplication. Creating SceneCover as you did isn't good idea due to above.

 

QObject::connect(app, SIGNAL( thumbnail() ), this, SLOT( onThumbnail() )); // <--- it's too late to create SceneCover. It will be refresh in 30 sec.

 

 

 

 

 

Developer
Posts: 411
Registered: ‎04-04-2012
My Device: BlackBerry Z30/Z10/Z10LE/Q10/PlayBook

Re: SetCover Image for the Application

@igosoft

 

 Can you update your code so it will compile in Beta 3? Thanks in advance.

Super Contributor
Posts: 306
Registered: ‎08-10-2010
My Device: Not Specified

Re: SetCover Image for the Application

Hi igosoft,

 

I tried your  sample but that did not work. Can you please give me brief idea how can i achieve this?

Developer
Posts: 71
Registered: ‎09-19-2012
My Device: Z10 very soon
My Carrier: Play

Re: SetCover Image for the Application

Hi

 

I'm using Beta3 with Dev Alpha Smiley Happy

 

Igor

Developer
Posts: 71
Registered: ‎09-19-2012
My Device: Z10 very soon
My Carrier: Play

Re: SetCover Image for the Application

Q: I tried your sample but that did not work. Can you please give me brief idea how can i achieve this?

@Meghasanghvi
Did you try with simulator or Dev Alpha ?
Developer
Posts: 71
Registered: ‎09-19-2012
My Device: Z10 very soon
My Carrier: Play

Re: SetCover Image for the Application

Here is the other thread with ActiveFrame

 

http://supportforums.blackberry.com/t5/Cascades-Development/Example-of-using-Active-Frames/td-p/1936...

 

I provided a link to working example. It was tested with Dev Alpha.

Developer
Posts: 889
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha
My Carrier: Verizon

Re: SetCover Image for the Application

Also, if you wish to just set the Scene Cover as a static image you can skip a few steps such as the update() method, listening for the onThumbnail event, and requesting Run when backgrounded permissions...


Read my thoughts on BlackBerry Development at news.ebscer.com
Developer
Posts: 71
Registered: ‎09-19-2012
My Device: Z10 very soon
My Carrier: Play

Re: SetCover Image for the Application

 

Yes. This is an implementation of ActiveFrame Smiley Happy.

Static version could be implemented with few lines of source code.

 

I added update method to be able to refresh ActiveFrame (cover) of applicaton.