[TinyTut] - Displaying a simple ProgressDialog

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

[TinyTut] - Displaying a simple ProgressDialog

Postby plusminus » Tue Dec 11, 2007 12:45 am

[TinyTut] - Displaying a simple ProgressDialog


What you learn: You will learn how to display a simple ProgressDialog.

Difficulty: 1.1 of 5 :)

:idea: Questions/Problems: Simply post below...

What it will look like:
Image


Description:
Generally the life of a progress-bar is guided by the following lines:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         ProgressDialog myProgressDialog = null;
  2.         // ...
  3.         myProgressDialog = ProgressDialog.show(TestLayout.this,
  4.                 "Please wait...", "Doing Extreme Calculations...", true);
  5.         // ...
  6.                 // Do some Fake-Work
  7.         // ...
  8.         myProgressDialog.dismiss();
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


:idea: Note: the work should ( :!: ) be not be done in the GUI-Thread, as if you miss that, the Progressbar will not see daylight :!:

As always, there are like 10[sup]60[/sup] Overloads, where you can define if your ProgressDialog should be determinate or indeterminate(in this case), should be cancleable, etc...

Here you get to know the most common ProgressBar.
If you want to digg some deeper, have a look here (search for ProgressBar).


This is a kind of proper "real-life-implementation":
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package org.anddev.android.testproject;
  2.  
  3. import android.app.Activity;
  4. import android.app.ProgressDialog;
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.view.View.OnClickListener;
  8. import android.widget.Button;
  9.  
  10. public class TestLayout extends Activity {
  11.        
  12.         ProgressDialog myProgressDialog = null;
  13.        
  14.     @Override
  15.     public void onCreate(Bundle icicle){
  16.         super.onCreate(icicle);
  17.  
  18.         /* Create a very simple button */
  19.         Button b = new Button(this);
  20.         this.setContentView(b);
  21.         b.setText("Show ProgressBar...");
  22.        
  23.         /* Assign the OnClicklistener to it,
  24.          * that will fake some work and
  25.          * display a progress-bar */
  26.         b.setOnClickListener(myProgressBarShower);
  27.     }
  28.        
  29.     /** OnClickListener that fakes some work to be done. */
  30.         OnClickListener myProgressBarShower = new OnClickListener(){
  31.                 // @Override
  32.                 public void onClick(View arg0) {
  33.                         // Display an indeterminate Progress-Dialog
  34.                         myProgressDialog = ProgressDialog.show(TestLayout.this,
  35.                                         "Please wait...", "Doing Extreme Calculations...", true);
  36.                        
  37.                         new Thread() {
  38.                                 public void run() {
  39.                                         try{
  40.                                                 // Do some Fake-Work
  41.                                                 sleep(5000);
  42.                                         } catch (Exception e) { }
  43.                                         // Dismiss the Dialog
  44.                                         myProgressDialog.dismiss();
  45.                                 }
  46.                         }.start();
  47.                 }
  48.     };
  49. }
Parsed in 0.037 seconds, using GeSHi 1.0.8.4


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Postby faldureon » Thu Jan 03, 2008 11:12 pm

You might have an issue calling myProgressDialog.dismiss(); from a non ui thread. If that happens just use


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. Handler handler=new Handler();
  3.  
  4.  
  5.  
  6. handler.post(new Runnable(){public void run(){myProgressDialog.dismiss();}})
  7.  
  8.  
  9.  
  10.  
Parsed in 0.063 seconds, using GeSHi 1.0.8.4
faldureon
Developer
Developer
 
Posts: 27
Joined: Sun Dec 02, 2007 10:19 pm

Postby Cheefrocker » Mon Mar 24, 2008 7:40 pm

Hey Guys!

I try this : But the progressbar doesnet change visualy.



Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.             // Display an indeterminate Progress-Dialog
  3.  
  4.                                 final ProgressDialog myProgressDialog = ProgressDialog.show(Country.this,    
  5.  
  6.                                  "Please wait...", "Trying to load the Events", true);
  7.  
  8.                                  
  9.  
  10.                                
  11.  
  12.  
  13.  
  14.                         Handler handler=new Handler();
  15.  
  16.                        
  17.  
  18.                                         handler.post(new Runnable(){public void run(){try {
  19.  
  20.                                                 Thread.sleep(2000);
  21.  
  22.                                                
  23.  
  24.                                         } catch (InterruptedException e) {
  25.  
  26.                                                 // TODO Auto-generated catch block
  27.  
  28.                                                 e.printStackTrace();
  29.  
  30.  
  31.  
  32.  
  33.  
  34.                                 }myProgressDialog.dismiss();}});
  35.  
  36.                             // Do some Fake-Work
  37.  
  38.  
Parsed in 0.074 seconds, using GeSHi 1.0.8.4
Cheefrocker
Freshman
Freshman
 
Posts: 4
Joined: Sat Feb 02, 2008 11:58 am

Postby venkat » Thu Mar 27, 2008 11:56 am

Thanks Cheefrocker
Regards,
Venkat.
venkat
Senior Developer
Senior Developer
 
Posts: 152
Joined: Tue Nov 27, 2007 5:42 am
Location: India

Postby tearcry » Wed Apr 09, 2008 5:45 am

Cheefrocker wrote:Hey Guys!

I try this : But the progressbar doesnet change visualy.



Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.             // Display an indeterminate Progress-Dialog
  2.                                 final ProgressDialog myProgressDialog = ProgressDialog.show(Country.this,    
  3.                                  "Please wait...", "Trying to load the Events", true);
  4.                                  
  5.                                
  6.  
  7.                         Handler handler=new Handler();
  8.                        
  9.                                         handler.post(new Runnable(){public void run(){try {
  10.                                                 Thread.sleep(2000);
  11.                                                
  12.                                         } catch (InterruptedException e) {
  13.                                                 // TODO Auto-generated catch block
  14.                                                 e.printStackTrace();
  15.  
  16.  
  17.                                 }myProgressDialog.dismiss();}});
  18.                             // Do some Fake-Work
  19.  
Parsed in 0.038 seconds, using GeSHi 1.0.8.4

same to you, how to solve this? thanks
tearcry
Freshman
Freshman
 
Posts: 8
Joined: Sat Mar 29, 2008 1:17 pm
Location: CN

Postby tearcry » Wed Apr 09, 2008 6:58 am

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. when you are loading ,you can do this
  3.  
  4. Hanlder hanlder=new Hanlder();
  5.  
  6. new LoadingThread(hanlder).start();
  7.  
  8.  
  9.  
  10.  
  11.  
  12. class LoadingThread extends Thread {
  13.  
  14.                 Handler handler;
  15.  
  16.                 public Loading(Handler hanlder) {
  17.  
  18.                         super();
  19.  
  20.                         this.handler=hanlder;
  21.  
  22.                 }
  23.  
  24.                
  25.  
  26.                 public void run() {
  27.  
  28.                         TodayFutureParser parser=null;
  29.  
  30.                        
  31.  
  32.                         try{
  33.  
  34.                                        //do some work
  35.  
  36.                               sleep(5000);
  37.  
  38.                              
  39.  
  40.                         } catch (InterruptedException e) {                             
  41.  
  42.                                
  43.  
  44.                         }              
  45.  
  46.                         handler.post(new FinishThread());
  47.  
  48.                 }
  49.  
  50.         }
  51.  
  52.  
  53.  
  54.  
  55.  
  56.         class FinishThread extends Thread {    
  57.  
  58.                
  59.  
  60.        
  61.  
  62.                 public void run() {
  63.  
  64.                            //you can change UI etc
  65.  
  66.                         if(myProgressDialog!=null)
  67.  
  68.                                 myProgressDialog.dismiss();
  69.  
  70.                 }
  71.  
  72.         }
Parsed in 0.038 seconds, using GeSHi 1.0.8.4
tearcry
Freshman
Freshman
 
Posts: 8
Joined: Sat Mar 29, 2008 1:17 pm
Location: CN

Top

Postby darolla » Wed Oct 01, 2008 1:24 pm

Hello,

thanks for this.

I'd like to change the message, but this isn't working:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         private OnClickListener myOnClickListener = new OnClickListener() {
  3.  
  4.                 public void onClick(View v) {
  5.  
  6.                         myProgressDialog = new ProgressDialog(TipicoActivity.this);
  7.  
  8.                         myProgressDialog.setTitle("Please wait...");
  9.  
  10.                         myProgressDialog.setMessage("Contacting Tipico...");
  11.  
  12.                         myProgressDialog.setIcon(R.drawable.blind);
  13.  
  14.                         myProgressDialog.show();
  15.  
  16.  
  17.  
  18.                         new Thread() {
  19.  
  20.                                 public void run() {
  21.  
  22.                                         try {
  23.  
  24.                                                 sleep(5000);
  25.  
  26.                                         } catch (Exception e) {
  27.  
  28.                                         }
  29.  
  30.                                         myProgressDialog.setMessage("Loggin in...");
  31.  
  32.                                         try {
  33.  
  34.                                                 sleep(5000);
  35.  
  36.                                         } catch (Exception e) {
  37.  
  38.                                         }                                                                              
  39.  
  40.                                         myProgressDialog.dismiss();
  41.  
  42.                                 }
  43.  
  44.                         }.start();
  45.  
  46.                 }
  47.  
  48.         };
  49.  
  50.  
Parsed in 0.039 seconds, using GeSHi 1.0.8.4
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Postby ninor » Wed Oct 01, 2008 5:15 pm

Yes. It seems that the dialog must be re-created to show another message.
It doesn't crash the app if the 2nd setMessage is commented.
User avatar
ninor
Moderator
Moderator
 
Posts: 180
Joined: Thu Aug 14, 2008 6:30 pm
Location: Barcelona, Spain

"real-life-implementation"

Postby Sparkletron » Thu Nov 06, 2008 12:32 am

Thank you for the example but can someone elaborate and post an example wherein the result of some lengthy process is then displayed in the GUI?

Here's the Catch-22. You can't put a lengthy process in the GUI thread or else you will never see the progress bar. So you have to put the lengthy process in its own thread. But you also can't seem to update the GUI thread from outside the GUI thread. So how do you get the results of the lengthy progress bar into the GUI? What is the best practice?

I tried using a custom EventObject and EventListener to notify the Activity. The event caused the Activity to dismiss the progress bar and update a TextView with the results. But I got buggy results, probably because the call to notify all the listeners resides in the lengthy process thread.
Sparkletron
Developer
Developer
 
Posts: 26
Joined: Tue Nov 04, 2008 6:17 am

Re: "real-life-implementation"

Postby Sparkletron » Thu Nov 06, 2008 6:43 pm

The answer to my question appears to be a Handler. The fact that you can't use your own Event model is probably a bug. When I use a custom Event model, I don't get a CalledFromWrongThreadException, but I don't get a proper view, either. Instead I get a buggy result that is difficult to qualify.
Sparkletron
Developer
Developer
 
Posts: 26
Joined: Tue Nov 04, 2008 6:17 am

Postby Artur79 » Sun Nov 09, 2008 4:24 pm

tearcry I've tried to run your example, but have an error, here's a full code

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package org.anddev.android.progressbar;
  2.  
  3. import android.app.Activity;
  4. import android.app.ProgressDialog;
  5. import android.os.Bundle;
  6. import android.os.Handler;
  7. import android.view.View;
  8. import android.view.View.OnClickListener;
  9. import android.widget.Button;
  10.  
  11. public class ProgressBar extends Activity {
  12.  
  13.     ProgressDialog myProgressDialog = null;
  14.    
  15.     @Override
  16.     public void onCreate(Bundle icicle){
  17.         super.onCreate(icicle);
  18.  
  19.         /* Create a very simple button */
  20.         Button b = new Button(this);
  21.         this.setContentView(b);
  22.         b.setText("Show ProgressBar...");
  23.        
  24.         /* Assign the OnClicklistener to it,
  25.          * that will fake some work and
  26.          * display a progress-bar */
  27.         b.setOnClickListener(myProgressBarShower);
  28.     }
  29.      
  30.     /** OnClickListener that fakes some work to be done. */
  31.      OnClickListener myProgressBarShower = new OnClickListener(){
  32.           // @Override
  33.           public void onClick(View arg0) {
  34.                // Display an indeterminate Progress-Dialog
  35.                   myProgressDialog = ProgressDialog.show(ProgressBar.this,    
  36.                          "Please wait...", "Doing Extreme Calculations...", true);
  37.                
  38.                Handler handler=new Handler();
  39.                new LoadingThread(handler).start();
  40.                
  41.           }
  42.     };
  43. }
  44.  
  45. class LoadingThread extends Thread {
  46.        
  47.     Handler handler;
  48.     public LoadingThread(Handler handler) {
  49.          super();
  50.          this.handler=handler;
  51.     }
  52.    
  53.     public void run() {
  54.        
  55.          try{
  56.              //do some work
  57.              sleep(5000);
  58.                    
  59.          } catch (InterruptedException e) {                
  60.              
  61.          }        
  62.          handler.post(new FinishThread());
  63.     }
  64. }
  65.  
  66.  
  67. class FinishThread extends Thread {    
  68.    
  69.     public void run() {
  70.          //you can change UI etc
  71.          if(myProgressDialog!=null)
  72.               myProgressDialog.dismiss();
  73.     }
  74. }
  75.  
Parsed in 0.044 seconds, using GeSHi 1.0.8.4


error is in last lines in FinishTread class:

myProgressDialog cannot be resolved


Could someone example me what's the purpose of using this handlers construction instead plusminus code from the fist post ?
Artur79
Developer
Developer
 
Posts: 26
Joined: Fri Sep 26, 2008 12:53 pm

change the message on the ProgressDialog

Postby shabbir » Tue Dec 23, 2008 10:39 am

Hi,
An example to change the message on the ProgressDialog.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. public class TestProgressDialog extends Activity
  3.  
  4. {
  5.  
  6.     ProgressDialog progressDialog = null;
  7.  
  8.     Handler progressHandler = new Handler();
  9.  
  10.     Button b;
  11.  
  12.     TextView textView;
  13.  
  14.     Login loginThread;
  15.  
  16.  
  17.  
  18.     @Override
  19.  
  20.     public void onCreate( Bundle icicle )
  21.  
  22.     {
  23.  
  24.         super.onCreate( icicle );
  25.  
  26.         textView = new TextView( this );
  27.  
  28.         textView.setText( "Click button to log-in" );
  29.  
  30.         b = new Button( this );
  31.  
  32.         LinearLayout layout = new LinearLayout(this);
  33.  
  34.         layout.addView(b);
  35.  
  36.         layout.addView(textView);
  37.  
  38.         this.setContentView( layout );
  39.  
  40.         b.setText( "Show Progress..." );
  41.  
  42.         b.setOnClickListener( new MyProgressBarShower( this ) );
  43.  
  44.     }
  45.  
  46.  
  47.  
  48.     class MyProgressBarShower implements OnClickListener
  49.  
  50.     {
  51.  
  52.         TestProgressDialog testProgressDialog;
  53.  
  54.         public MyProgressBarShower( TestProgressDialog argTestProgressDialog )
  55.  
  56.         {
  57.  
  58.             testProgressDialog = argTestProgressDialog;
  59.  
  60.         }
  61.  
  62.  
  63.  
  64.         @Override
  65.  
  66.         public void onClick( View argV )
  67.  
  68.         {
  69.  
  70.             progressDialog = ProgressDialog.show( TestProgressDialog.this, "", "Connecting...", false, true );
  71.  
  72.             textView.setText( "Connecting..." );
  73.  
  74.             loginThread = new Login(testProgressDialog);            
  75.  
  76.             loginThread.start();
  77.  
  78.         }
  79.  
  80.     }
  81.  
  82.    
  83.  
  84.     public void showState( final String argState )
  85.  
  86.     {
  87.  
  88.         // use of progressHandler is important
  89.  
  90.         progressHandler.post( new Runnable()
  91.  
  92.         {
  93.  
  94.             public void run()
  95.  
  96.             {
  97.  
  98.                 if( "LoggedIn".equals( argState ) )
  99.  
  100.                 {
  101.  
  102.                     textView.setText( "Login completed...." );
  103.  
  104.                     progressDialog.dismiss();
  105.  
  106.                     loginThread.stop();
  107.  
  108.                     loginThread = null;
  109.  
  110.                 }
  111.  
  112.                 else
  113.  
  114.                 {
  115.  
  116.                     textView.setText( argState + "..." );
  117.  
  118.                     progressDialog.setMessage(  argState + "..." );
  119.  
  120.                 }
  121.  
  122.             }
  123.  
  124.         });
  125.  
  126.     }
  127.  
  128.    
  129.  
  130.     class Login extends Thread
  131.  
  132.     {
  133.  
  134.         TestProgressDialog testProgressDialog;
  135.  
  136.         public Login( TestProgressDialog argtestProgressDialog )
  137.  
  138.         {
  139.  
  140.             testProgressDialog = argtestProgressDialog;
  141.  
  142.         }
  143.  
  144.  
  145.  
  146.         public void run()
  147.  
  148.         {
  149.  
  150.             for( int i=1; i<=12; i++ )
  151.  
  152.             {
  153.  
  154.                 try
  155.  
  156.                 {
  157.  
  158.                     sleep( 1000 );
  159.  
  160.                 }
  161.  
  162.                 catch( InterruptedException e )
  163.  
  164.                 {
  165.  
  166.                     e.printStackTrace();
  167.  
  168.                 }
  169.  
  170.                 switch( i )
  171.  
  172.                 {
  173.  
  174.                     case 3:
  175.  
  176.                         testProgressDialog.showState( "Authenticating" );
  177.  
  178.                         break;
  179.  
  180.                     case 6:
  181.  
  182.                         testProgressDialog.showState( "Logging in" );    
  183.  
  184.                         break;
  185.  
  186.                     case 9:
  187.  
  188.                         testProgressDialog.showState( "LoggedIn" );
  189.  
  190.                         break;
  191.  
  192.                 }
  193.  
  194.             }
  195.  
  196.         }
  197.  
  198.     }
  199.  
  200.  
  201.  
  202. }
  203.  
  204.  
Parsed in 0.049 seconds, using GeSHi 1.0.8.4
thanx,
Shabbir
User avatar
shabbir
Freshman
Freshman
 
Posts: 2
Joined: Tue Dec 23, 2008 10:27 am

Postby bonny » Wed Jan 07, 2009 12:06 pm

Hi guys. I have a question for you. How can I set message from resources? I want to set the message of the progress dialog from R.string.message, for example. How can I do it?Is it possible?
bonny
Junior Developer
Junior Developer
 
Posts: 19
Joined: Fri Apr 11, 2008 2:08 pm

Postby Mrs Harris » Fri Jan 16, 2009 2:31 pm

Hey all,

1st post so please be gentle :)

I have been playing with this trying to get to the following situation:
Some complex task is run not in the UI thread and that a progressdialog is shown during that time. Once the processing is done I wanted some result of the processing to be passed back and the GUI updated with this.

Here's what I have. I'd appreciate all comments and hope that this perhaps helps some others. I think this is right but I'm just sad that I have to set the return value rather than sending this is the handler.post() etc function calls.

Obviously here I've set the ID of the TextView but apart from that I'm using the default code that Eclipse generates.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. package com.tmobile.android.back;
  3.  
  4.  
  5.  
  6. import android.app.Activity;
  7.  
  8. import android.app.ProgressDialog;
  9.  
  10. import android.os.Bundle;
  11.  
  12. import android.os.Handler;
  13.  
  14. import android.widget.TextView;
  15.  
  16.  
  17.  
  18. public class TestThreading extends Activity {
  19.  
  20.         private Handler handler = new Handler();
  21.  
  22.         private String strTest = null;
  23.  
  24.         ProgressDialog myProgressDialog = null;
  25.  
  26.        
  27.  
  28.     /** Called when the activity is first created. */
  29.  
  30.     @Override
  31.  
  32.     public void onCreate(Bundle savedInstanceState) {
  33.  
  34.         super.onCreate(savedInstanceState);
  35.  
  36.         setContentView(R.layout.main);
  37.  
  38.         mainProcessing();
  39.  
  40.     }
  41.  
  42.  
  43.  
  44.         private void mainProcessing() {
  45.  
  46.                 Thread thread =  new Thread(null, doBackgroundProc, "Background2");
  47.  
  48.                 thread.start();
  49.  
  50.                 myProgressDialog = ProgressDialog.show(TestThreading.this,    
  51.  
  52.                 "Please wait...", "Doing Extreme Calculations...", true);
  53.  
  54.         }
  55.  
  56.        
  57.  
  58.         private void returnRes(){
  59.  
  60.                 TextView tvBal = (TextView)findViewById(R.id.txtTest);
  61.  
  62.                 tvBal.setText(strTest);
  63.  
  64.                 myProgressDialog.dismiss();
  65.  
  66.         }
  67.  
  68.        
  69.  
  70.         private Runnable doBackgroundProc = new Runnable(){
  71.  
  72.                 public void run(){
  73.  
  74.                         backgroundProc();
  75.  
  76.                 }
  77.  
  78.         };
  79.  
  80.        
  81.  
  82.         private void backgroundProc(){ 
  83.  
  84.                 try{
  85.  
  86.             // Do some Fake-Work
  87.  
  88.             Thread.sleep(2000);
  89.  
  90.        } catch (Exception e) {  }
  91.  
  92.         strTest = "123";
  93.  
  94.                 handler.post(doReturnRes);
  95.  
  96.         }
  97.  
  98.        
  99.  
  100.         private Runnable doReturnRes = new Runnable(){
  101.  
  102.                 public void run(){
  103.  
  104.                         returnRes();
  105.  
  106.                 }
  107.  
  108.         };
  109.  
  110.        
  111.  
  112. }
  113.  
  114.  
Parsed in 0.042 seconds, using GeSHi 1.0.8.4
Mrs Harris
Freshman
Freshman
 
Posts: 8
Joined: Fri Jan 16, 2009 2:22 pm

Postby MrSnowflake » Fri Jan 16, 2009 3:10 pm

Mrs Harris wrote:...
I'm just sad that I have to set the return value rather than sending this is the handler.post() etc function calls.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         private void backgroundProc(){ 
  2.                 try{
  3.             // Do some Fake-Work
  4.             Thread.sleep(2000);
  5.        } catch (Exception e) {  }
  6.         strTest = "123";
  7.                 handler.post(doReturnRes);
  8.         }
  9.        
  10.         private Runnable doReturnRes = new Runnable(){
  11.                 public void run(){
  12.                         returnRes();
  13.                 }
  14.         };
  15.        
  16. }
  17.  
Parsed in 0.037 seconds, using GeSHi 1.0.8.4
You don't have to! If you define the doReturnRes runnable in backgroundProc() then you can imediately use the strTest. Eg:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         private void backgroundProc(){ 
  2.                 try{
  3.             // Do some Fake-Work
  4.             Thread.sleep(2000);
  5.        } catch (Exception e) {  }
  6.             final String strTest = "123";
  7.             // Your code:
  8.             handler.post(new Runnable() {
  9.               void run() {
  10.                  // use strTest here
  11.                  Log.d("TEST", "Look, I printed strTest: "+strTest);
  12.               }
  13.             /* My very small improvement:
  14.             runOnUiThread(new Runnable() {
  15.               void run() {
  16.                  // use strTest here
  17.                  Log.d("TEST", "Look, I printed strTest: "+strTest);
  18.               }
  19.             }
  20.           });
  21.         }
  22.  
Parsed in 0.038 seconds, using GeSHi 1.0.8.4
If that's what you meant.

Oh and in this case using Activity.runOnUiThread() might be a tad better then using a new Handler object.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Top
Next

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 11 guests