Hi!

Using a thread is probably what you want, if it is a big file that you
are uploading you might even consider using a service instead
(bindService()) so it will continue to upload even if your activity is
stop()'ed (the user leaves it by pressing the home-button or
similair). The following code will use a Thread to upload the data:

Thread t = new Thread() {


On 24 Apr, 09:03, "pramod.deore" <deore.pramo...@gmail.com> wrote:
> Hello everybody,
>          I am developing one application in that I am using progress
> bar. but progress bar is display after task is completed.but I want to
> run progress bar first and task must be completing in background. Here
> is my code
>
> import android.app.Activity;
> import android.os.Bundle;
> import android.view.View;
> import android.view.View.OnClickListener;
> import android.widget.Button;
>
> public class Progress extends Activity implements OnClickListener
> {
>         Button yesButton,noButton;
>     /** Called when the activity is first created. */
>     @Override
>     public void onCreate(Bundle savedInstanceState)
>     {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.main1);
>         yesButton = (Button) findViewById(R.id.widget31);
>         noButton = (Button) findViewById(R.id.widget32);
>
>         yesButton.setOnClickListener(this);
>         noButton.setOnClickListener(this);
>     }
>
>     public void onClick(View v)
>     {
>         if (v==yesButton)
>                 {
>                 setContentView(R.layout.main3);
>                 sendFileToServer();
>                 }
>     }
>
>     public void sendFileToServer()
>     {
>         for (int i=0;i<5000;i++)
>         {
>                         System.out.println ("Now value of i is"+i);
>         }
>     }
>
> }
>
> Here it prints value of i from 0 to 4999 then after that
> R.layout.main3 is displayed.
> what should I have to do? should I have to create a class that extends
> from Service class in that palced the method sendFileToServer
>
> Please help me.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to