Are you able to see the number of bytes loaded in logcat?
Basically I'm not sure if you are having trouble finding the number, or having trouble showing that number to the user.
if you see here:
URLConnection | Android Developers
they use a "place holder" method called
readStream(in);
In your version that method, you should be able to count the number of bytes read.
To publish that number to the dialog, use a Handler.
in your activity:
Code:
// using 5 as example, use any int here
private static final int PROG_ID = 5;
private final Handler mHandler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
switch (msg.what)
{
case PROG_ID:
handleUpdateProgress( msg.arg1 );
break;
}
}
};
protected void handleUpdateProgress (int progressPercent)
{
myProgressDialog.setProgress(progressPercent);
}
in your ASyncTask send the
percent:
Code:
mHandler.obtainMessage(PROG_ID, percent, -1, null).sendToTarget();
(This is off the top of my head so might not work perfectly but should help you get the idea).