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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
New Contributor
Siyaa
Posts: 2
Registered: ‎09-14-2012
My Carrier: Various
Accepted Solution

How to update UI without encountering an 'Application not responding; process terminated'?

I am trying to populate a table on the screen as and when the user clicks a Labelfield (20 rows are populated per click).

 

When the user clicks the labelfield, following takes place:

1). A chunk of data is read from the SQLite database in a background thread.

2). The data is then populated within the existing table on the screen (by adding more fields to the Table Layout Manager) in the invokeLater() method.

 

I am currently facing a problem of 'Application not responding; process terminated' when i keep loading more items for say about 3 to 4 times (i.e. after around 60-80 rows are populated).

 

I am afraid this could be caused due to the UI thread getting held up for a long time while the population is taking place. Is there a different way to update the UI, so that the app runs smoothly?

I would appreciate any help as I have been held up with this problem for some time now.

 

Thanks and regards,
Siya
Please use plain text.
Trusted Contributor
babakar
Posts: 222
Registered: ‎05-29-2012
My Carrier: see later

Re: How to update UI without encountering an 'Application not responding; process terminated'?

[ Edited ]

I dont know if I get you right, I did a similar thing with page flipping a list of data. Because a large chunk of rows will end up with out of memory error

Please use plain text.
New Contributor
muhachev
Posts: 4
Registered: ‎09-16-2012
My Carrier: MTS

Re: How to update UI without encountering an 'Application not responding; process terminated'?

You should use another thread for querying database and then creating and populating fields. After creating fields use method Manager.addAll() to add an array of fields (in invokeLater() body of course).
Please use plain text.
Developer
simon_hain
Posts: 13,830
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: How to update UI without encountering an 'Application not responding; process terminated'?

welcome to the support forums.

muhachev tip is good, using addAll reduces load, and only that has to be put inside invokelater, field creation can be done on the thread.

if you have so many lines you could also check out listfield, it has a very high performance for bigger amounts of data.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
New Contributor
Siyaa
Posts: 2
Registered: ‎09-14-2012
My Carrier: Various

Re: How to update UI without encountering an 'Application not responding; process terminated'?

[ Edited ]

Thank you so much. That worked. It was of great help.

Thanks and regards,
Siya
Please use plain text.