progress bar in android
<p>my progress bar is show but not move horizontal. Here is my code :</p>

<pre><code> package com.net.pvr;

 import java.io.BufferedInputStream;
 import java.io.InputStream;
 import java.net.URL;
 import java.net.URLConnection;

 import org.apache.http.util.ByteArrayBuffer;

 import android.app.Activity;
 import android.app.ProgressDialog;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
 import android.util.Log;

public class HTTPLocation implements Runnable {
private static HTTPLocation instance;


private ProgressDialog myProgressDialog;
private ByteArrayBuffer baf;
private Activity activity;
public String url;
public String id;
private HTTPLocation()
{
}
public Activity getActivity() {
    return activity;
}

public void setActivity(Activity activity) {
    this.activity = activity;
}


private Handler handler;
public String getId() {
    return id;
}

public void setId(String id) {
    this.id = id;
}

public String getUrl() {
    return url;
}

public void setUrl(String url) {
    this.url = url;
}


public Handler getHandler() {
    return handler;
}

public void setHandler(Handler handler) {
    this.handler = handler;
}

public static HTTPLocation getInstance() {

        instance = new HTTPLocation();
        return instance;
}

  public void init() {


    myProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    myProgressDialog.setProgress(0);
    myProgressDialog.incrementProgressBy(5);
    myProgressDialog.setMax(100);

        Thread t = new Thread(this);

    t.start();

}

@Override
public void run() {
    try {

        String url1 = this.getUrl();
        System.out.println("url "+url1);
        URL url = new URL(url1);

        URLConnection urlConn = url.openConnection();
        urlConn.setConnectTimeout(10000);
        InputStream is = urlConn.getInputStream();
        BufferedInputStream bis = new BufferedInputStream(is);
        baf = new ByteArrayBuffer(1000);            
        int current = 0;
        while ((current = bis.read()) != -1) {
            baf.append((byte) current);
        }
        bis.close();
        is.close();

    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        Bundle bundle = new Bundle();


        if(baf!=null){
            bundle.putByteArray("data", baf.toByteArray());
        }else{
            bundle.putByteArray("data", null);  
        }

        Message messagepush = Message.obtain();
        messagepush.what = 200;
        messagepush.setData(bundle);
        messagepush.setTarget(handler);
        myProgressDialog.setIndeterminate(false);

        myProgressDialog.dismiss();
        messagepush.sendToTarget();
    }
}

}
</code></pre>
