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

Java Development

Reply
Developer
martijnbrinkers
Posts: 155
Registered: ‎02-18-2009
My Device: Not Specified

Re: Screen slow inside application

quote: "Maybe you could consider using IPC to get the processing back into your own application and that would solve the problem?"

 

I used a global event and from the global event handler I tried to open the screen. The screen however is not shown. The main code of my application is a system module that registers some handlers for handling email events etc. I also added a system menu which opens a screen on which you can enter a message. This screen overrides paint(..).

Because I do not have a 'normal' application that is always open with a UI I registered the global event in the startup code of my system module (the system module is a UIApplication with an event dispatcher) using addGlobalEventListener. However if I try to push a screen in the global event handler nothing is shown (I also tried with invokeLater that didn't make a difference). I sure the event dispatcher is working because if I call enterEventDispatcher an exception is thrown with the message that only one event dispatcher can be registered.

When I use pushGlobalScreen instead of pushScreen the screen is shown but then I run into all kinds of problems because other screens and Dialog's opened from the main screen no longer work.

 

Any idea?

 

The whole thing started because when overriding paint results in sluggish behavior on a 8900. Do you think that that's a bug?

Please use plain text.
New Developer
ankitagnity
Posts: 4
Registered: ‎02-01-2010
My Device: 8900, 9000, 9550, 8320

Re: Screen slow inside application

Instead of overriding the paint method of a screen or a manager, you can override subpaint method, which is called by paint and will not result in performance penalty

Please use plain text.
Developer
martijnbrinkers
Posts: 155
Registered: ‎02-18-2009
My Device: Not Specified

Re: Screen slow inside application

I tried overriding subpaint for the MainScreen but it doesn't seem to be called ever. Could it be that subpaint is not used for a MainScreen?

Please use plain text.
New Developer
ankitagnity
Posts: 4
Registered: ‎02-01-2010
My Device: 8900, 9000, 9550, 8320

Re: Screen slow inside application

have u overriden the paint() method also? the default paint() calls subpaint() but ur implementation might not have

Please use plain text.
Developer
martijnbrinkers
Posts: 155
Registered: ‎02-18-2009
My Device: Not Specified

Re: Screen slow inside application

I added a VerticalManager and added all my controls to this manager. Overriding subpaint however did not solve it, it was still slow.

 

The strange thing is that it really makes no difference what the code in the overridden paint does. Merely the fact that paint is overridden results in a sluggish screen.

Please use plain text.
Developer
peter_strange
Posts: 19,608
Registered: ‎07-14-2008
My Device: Not Specified

Re: Screen slow inside application

"Merely the fact that paint is overridden results in a sluggish"

 

That is a difficult one to get your head round.  Even if you just put in super.paint()!?  How does it know it has been overridden?  You haven't changed the signature at all I presume?

 

Weird.....

 

Anyway, I have a test 8900 running 4.6.1.199, which I'm happy to try something on.  I got the impression from a previous post that it was relatively easy to create this problem, or do you need a large application?

Please use plain text.
Developer
martijnbrinkers
Posts: 155
Registered: ‎02-18-2009
My Device: Not Specified

Re: Screen slow inside application

"That is a difficult one to get your head round.  Even if you just put in super.paint()!?  How does it know it has been overridden?"

 

if I only add super.paint() the screen is fast but I think that's because the compiler sees that there is no need to override it. It doesn't really matter what I add to the overridden paint. Even a check that always results in false will result in sluggish paint.

 

"You haven't changed the signature at all I presume?"

 

No I haven't. I tried to make the paint final in the hope that the compiler would then do some optimizations but that didn't make any difference.

 

"Anyway, I have a test 8900 running 4.6.1.199, which I'm happy to try something on.  I got the impression from a previous post that it was relatively easy to create this problem, or do you need a large application?"

 

I tried to reproduce it with a new test application. The strange thing is that I couldn't reproduce it. It makes me think that the problem is somehow related to a 'large' application. My app is about 160K. The application will be released as open source so hopefully someone can help finding the cause.

Please use plain text.
Developer
martijnbrinkers
Posts: 155
Registered: ‎02-18-2009
My Device: Not Specified

Re: Screen slow inside application

Hi Peter and others willing to test,

 

"Anyway, I have a test 8900 running 4.6.1.199, which I'm happy to try something on.  I got the impression from a previous post that it was relatively easy to create this problem, or do you need a large application?"

 

I managed to create a simple test program which replicates the sluggishness. The application contains some dummy code, duplicate screens and large text constants to make sure the cod is large as the problem seems only to occur with large applications. The application is a system module that registers two application menu items for the mail application. The first menu item opens a screen that does not override the paint method and the second menu item opens the exact same screen (a 100% copy) but now with the paint overridden (I made a copy of the screen and did not extend it to make the cod file larger).

 

The only relevant files are 8900Test (the main file), TestScreen and TestScreenOverride. The other files are just to upsize the cod.

 

The JAD project can be downloaded from here

 

I hope you are willing to take a look at it to see if you can replicate it on your 8900.

 

PS the 8900 I tested it on has OS version 4.6.1.310

 

Please use plain text.
Developer
martijnbrinkers
Posts: 155
Registered: ‎02-18-2009
My Device: Not Specified

Re: Screen slow inside application

Is there someone with a 8900 who can help me test whether the problem occurs on all 8900 devices?

 

See previous message.

Please use plain text.
Developer
peter_strange
Posts: 19,608
Registered: ‎07-14-2008
My Device: Not Specified

Re: Screen slow inside application

I see the same thing.  Installed the app on 8900 running 4.6.1.199 (fairly old I know) and the overridden screen is slower.  Installed the same thing on a Sprint 8530, running V5.0.0.236, and both overridden and non overridden run the same and fast. 

Please use plain text.