android progressbar
<p>hi could some one show me how to add a progress bar to this method :</p>

<pre><code>public boolean sendFile(String path,String ip, int port)  {
        // TODO Auto-generated method stub


        try {


            String[] str = ip.split("\\.");

            byte[] IP = new byte[str.length];

            for (int i = 0; i &lt; str.length; i++) {

                IP[i] = (byte) Integer.parseInt(str[i]);


            }
            Socket socket = getSocket(InetAddress.getByAddress(IP), port);
            if (socket == null) {
                Log.i("SO sendFILE","");

                return false;
            }

            Log.i("SocketOP", "sendFILE-1");
            File  f = new File(path);
            String filename=path.substring(path.lastIndexOf("/")+1);
            System.out.println("filename:"+filename); 
            fin.filename = "~"+filename;
            BufferedOutputStream out = new BufferedOutputStream( socket.getOutputStream() );

            FileInputStream fileIn = new FileInputStream(f);
            Log.i("SocketOP", "sendFILE-2");
            byte [] buffer  = new byte [(int)f.length()];
            System.out.println("SO sendFile f.length();" + f.length());
            int bytesRead =0;
            while ((bytesRead = fileIn.read(buffer)) &gt; 0) {
                out.write(buffer, 0, buffer.length);
                System.out.println("SO sendFile" + bytesRead +filename);
            }
            out.flush();
            out.close();
            fileIn.close();
            Log.i("SocketOP", "sendFILE-3");






        } catch (IOException e) {
            return false;           
            //e.printStackTrace();
        }
        //  Toast.makeText(this, "Lvbvhhging...", Toast.LENGTH_SHORT).show();

        return true;     
    }
</code></pre>

<p>thanks in advance.</p>
