>
 
                                
Ola Rafael to tedo um problema com o progressdialog  ele aparece mas não carrega e nem some da tela ta ai meu codigo 
grato
package br.com.lubella;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.widget.SimpleCursorAdapter;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;
public class EnviarPedido extends Activity implements Runnable {
	ListView listCarregaDados;
	//Button btEnviar;
	ProgressDialog pgd;
	Cursor cursor;
	SQLiteDatabase db;
	String error ="";
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.enviar_pedidos);
		
		listCarregaDados = (ListView)findViewById(R.idEnviarPedidos.listCarregaDados);
	//	btEnviar = (Button)findViewById(R.idEnviarPedidos.btEnviarPedido);
	
		//abre ou cria o banco
		  db = openOrCreateDatabase("vendas.db", Context.MODE_PRIVATE, null);
		//cursor para fazer o select
		 cursor = db.rawQuery("SELECT * FROM produtos ORDER BY nome ASC", null);
		
		//colunas para o listview
		String[] from = {"_id","nome","preco","quant","codigo","hora","tipopag","troco"};
		int[] to = {R.idList.txvID,R.idList.txvNome,R.idList.txvPreco,R.idList.txvQtd,
				R.idList.txvCod,R.idList.txvHora,R.idList.txvTipopag,R.idList.txvTroco}; //array de inteiro
		
		//SimpleCursorAdapter para adaptar ao listview
	SimpleCursorAdapter ad = new SimpleCursorAdapter(getBaseContext(), R.layout.listview, cursor, from, to);
	
	listCarregaDados.setAdapter(ad);
	
	Button btTelaPrincipal = (Button)findViewById(R.idEnviarPedidos.btTelaPrincipal);
	btTelaPrincipal.setOnClickListener(new View.OnClickListener() {
		
		@Override
		public void onClick(View v) {
			
			startActivity(new Intent(getBaseContext(),TelaPrincipal.class));
			
		}
	});
	/*
	btEnviar.setOnClickListener(new View.OnClickListener() {
		
		@Override
		public void onClick(View arg0) {
	
		}
	});*/
	}
	public void Enviar(View v){
		db = openOrCreateDatabase("vendas.db", Context.MODE_PRIVATE, null);
		cursor = db.rawQuery("SELECT * FROM produtos", null);
		
		    pgd = new ProgressDialog(EnviarPedido.this);
			pgd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
			pgd.setCancelable(false);
			pgd.setTitle("Enviand0o Pedido!");
			pgd.setProgress(0);
			pgd.setMax(cursor.getCount());
			pgd.show();
			new Thread(EnviarPedido.this).start();
		
	
		
	}
	public void mensagemExibir(String titulo, String texto) {
		AlertDialog.Builder mensagem = new AlertDialog.Builder(
				EnviarPedido.this);
		mensagem.setTitle(titulo);
		mensagem.setMessage(texto);
		//mensagem.setNeutralButton("OK", null);
		mensagem.show();
	}
	@Override
	public void run() {
		 
		 int totalDB = cursor.getCount();
		 int totalReplicado = 0;
		 
		 
		 while(cursor.moveToNext()){
			 System.out.println("esto no while");
			 StringBuilder strURL = new StringBuilder();
			 strURL.append("http://newcre8.com.br/dev/lubella/gerencia/android/dados_pedido.php?"); 
			 strURL.append("&nome=");
			 strURL.append(cursor.getString(cursor.getColumnIndex("nome")));
			 strURL.append("&email_cli=");
			 strURL.append(cursor.getString(cursor.getColumnIndex("email")));
			 //strURL.append("&preco=");
			// strURL.append(cursor.getDouble(cursor.getColumnIndex("preco")));
			 strURL.append("&cod_prod=");
			 strURL.append(cursor.getDouble(cursor.getColumnIndex("codigo")));
			 strURL.append("&quant=");
			 strURL.append(cursor.getDouble(cursor.getColumnIndex("quant")));
			 strURL.append("&hora=");
			 strURL.append(cursor.getString(cursor.getColumnIndex("hora")));
			 strURL.append("&tipopag=");
			 strURL.append(cursor.getString(cursor.getColumnIndex("tipopag")));
			 strURL.append("&troco=");
			 strURL.append(cursor.getDouble(cursor.getColumnIndex("troco")));
			 
			 Log.d("ExportarVendasService", strURL.toString());
			 
			 try{
				 URL url = new URL(strURL.toString());
				 HttpURLConnection http = (HttpURLConnection) url.openConnection();
				 InputStreamReader ips = new InputStreamReader(http.getInputStream());
				 BufferedReader line = new BufferedReader(ips);
				 
				 String linhaRetorno = line.readLine();
				 if(linhaRetorno!= "0"){
					 db.delete("produtos", "_id=?", new String[]{String.valueOf(cursor.getInt(0))});
					 totalReplicado++;
					 h1.sendEmptyMessage(0);
					 Log.d("ExportarVendasService", "OK");
					 
				 }
			 } catch(Exception ex){
				 Log.d("ExportarVendasService", ex.getMessage());
				 error = ex.getMessage();
				 h1.sendEmptyMessage(2);
			 }
			 if(totalDB == totalReplicado){
				h1.sendEmptyMessage(1);	
								 
				 Log.d("ver", "dados replicado " + totalReplicado);
				
				 } else {
					 error = "Ocorreu um erro no sistema!!";
					 h1.sendEmptyMessage(2);
					
				 }
		}
		//dbped.close();
	}
	public Handler h1 = new Handler();
	public void handleMessage(Message msg) {
		if (msg.what == 0) {
			pgd.setProgress(pgd.getProgress() + 1);
		} else if (msg.what == 1) {
			pgd.dismiss();
			Toast.makeText(getBaseContext(), "Pedido enviado com Suceso",
					Toast.LENGTH_SHORT).show();
			//startActivity(new Intent(getBaseContext(), TelaPrincipal.class));
		} else if (msg.what == 2) {
			pgd.dismiss();
			Toast.makeText(getBaseContext(), "Erro na replicação" + error,
					Toast.LENGTH_SHORT).show();
		}
	}
}
 
                                
	Olá
Quem chama o Enviar?
 
                                Desculpa a demora muito trabalho ja resolvi obrigado Rafael