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 - Progressbar does'nt work until the thread finsish its job

Progressbar does'nt work until the thread finsish its job

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

Progressbar does'nt work until the thread finsish its job

Postby demenphieuluuki » Sun Jun 13, 2010 4:04 am

Hello my friends!
I'm have a problem when working with progress bar and thread.
I want to show all images from sdcard. Because of the long loading time, I'd like to use a progress bar to show up end then disappear when the loading finishes.

However, it doesn't work as I expected. The progress bar hiberneted


Hello my friends!
I'm have a problem when working with progress dialog and thread.
I want to show all images from sdcard. Because of the long loading time, I'd like to use a progress dialog end then discard it when the loading images finishes.

However, it doesn't work as I expected. The progress dialog hibernates while the thread is running ( the loading images from sdcard and showing them to a listview ).

What's the problem here?

This is my codes:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  // use button click to open images from sdcard        
  2.         btnClick=(Button)findViewById(R.id.btnClick);      
  3.         btnClick.setOnClickListener(new OnClickListener() {
  4.                         @Override
  5.                         public void onClick(View v) {                  
  6.                         System.gc();   
  7.                        // show progress dialog
  8.                         showDialog(DIALOG2_KEY);
  9.  
  10.                       // start a new thread to load images and then discard the progress dilog
  11.                         ShowImage();
  12.                         }
  13.                 });
Parsed in 0.013 seconds, using GeSHi 1.0.8.4



Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. // Create a new thread for loading images    
  2.     public void ShowImage(){
  3.                
  4.                 thread = new Thread(this);
  5.                 // it works for  5 seconds
  6.                 try {
  7.                         thread.sleep(5000);
  8.                 } catch (InterruptedException e) {
  9.                         e.printStackTrace();
  10.                 }
  11.                 thread.start();
  12.     }
  13.     public void run() {
  14.        
  15.         // get Uris of Images from Sd card
  16.          getUri();        
  17.          handler.sendEmptyMessage(0);
  18.         }
  19.         private Handler handler = new Handler() {
  20.                 @Override
  21.                 public void handleMessage(Message msg) {
  22.                  
  23.                 // show images to gridview
  24.                 g.setAdapter(new ImageAdapter(getApplicationContext()));
  25.                          
  26.                 // remove Dialog
  27.                 removeDialog(DIALOG2_KEY);                       
  28.                 }
  29.         };
Parsed in 0.012 seconds, using GeSHi 1.0.8.4
demenphieuluuki
Freshman
Freshman
 
Posts: 3
Joined: Wed Mar 31, 2010 3:28 pm

Top

Re: Progressbar does'nt work until the thread finsish its jo

Postby demenphieuluuki » Sun Jun 13, 2010 4:10 am

This is my project. I'm waiting for your ideas! Thank so much! ^^
http://www.mediafire.com/?zznmzzyurmy
demenphieuluuki
Freshman
Freshman
 
Posts: 3
Joined: Wed Mar 31, 2010 3:28 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: MSNbot Media and 16 guests