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
New Contributor
Posts: 2
Registered: ‎09-14-2012
My Device: Blackberry Curve
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
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
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

New Contributor
Posts: 4
Registered: ‎09-16-2012
My Device: Simulator
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).
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
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
Highlighted
New Contributor
Posts: 2
Registered: ‎09-14-2012
My Device: Blackberry Curve
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