Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Thread, Activity and DB

Thread, Activity and DB

Put your problem here if it does not fit any of the other categories.

Thread, Activity and DB

Postby Malefico » Mon Nov 17, 2008 10:41 am

I have a problem:

i have an activity. It call a thread that access a sqlite db to process many data ( it takes about 5 sec ) ..

if during the thread is runnig i press the back or the home button the application crash.

How can i stop/destroy the thread? i think i have to do this in onPause() method.

thx
Malefico
Developer
Developer
 
Posts: 30
Joined: Fri Oct 24, 2008 3:32 pm

Top

Postby MrSnowflake » Mon Nov 17, 2008 11:51 am

The best way is to use Thread.join() (this'll make you activity wait for the thread to finish), because your thread could be writing stuff to the db. But you also should flag something in the Thread, to the Thread knows it's supposed to shutdown (just return from the run() is enough).
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby Malefico » Mon Nov 17, 2008 2:20 pm

Thanks! 8)

I think i will use both:
the FLAG to let thread know it must end.. and JOIN to wait the thread ends.
Malefico
Developer
Developer
 
Posts: 30
Joined: Fri Oct 24, 2008 3:32 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 13 guests