Freeze background activity when Progress Bar is running
<p>I am a facing a problem in my app.Actually,there is an activity in which i send an image to server.In xml layout file i use a progress bar view.The progress bar start loading when image is loading to server and dismiss when the work done.Everything working fine.The problem is that when progress bar is in running state the background activity is still active.I want to freeze the background activity while progress bar is in runnung state.The code is as follows. </p>

<pre><code>postPic.setOnClickListener(new View.OnClickListener() {

        @Override 
        public void onClick(View v){


        mProgressBar.setVisibility(View.VISIBLE);


                new Thread(){

                @Override
                public void run() {


                //here the code to post image to server 

                    handler.sendEmptyMessage(0);


                }


            }.start();
            }

        }

        private  Handler handler = new Handler() {
             @Override
             public void handleMessage(Message msg) {
                 try {


                     mProgressBar.setVisibility(View.GONE);


                        }

                      else  if(messagePostingItems.equalsIgnoreCase("Success")){

                        startActivity(new Intent(PostPhoto.this,PostPicDialog.class));

                     }
            };
    });
</code></pre>

<p>Please help me out from this problem.</p>
