Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8912863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:19:06+00:00 2026-06-15T04:19:06+00:00

how to check the amount of data in each time uploaded to the server,

  • 0

how to check the amount of data in each time uploaded to the server, this is my code which I call inside a AsyncTask

public  String conxDatosInPost(String Direccion, ArrayList<NameValuePair> Parametros) throws Exception {
  BufferedReader in = null;
  try {
    HttpClient client = ClienteHttp();
    HttpPost request = new HttpPost(Direccion);
    UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(Parametros);
    request.setEntity(formEntity);
    HttpResponse response = client.execute(request);
    //long logitud = response.getEntity().getContentLength();
    in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
    StringBuffer sb = new StringBuffer("");
    String line = "";
    String NL = System.getProperty("line.separator");
    while ((line = in.readLine()) != null) {
     sb.append(line + NL);
    } 
    in.close();
    String result = sb.toString();
    Log.d("El resultado de cnxposin es :-----------  ",  result +"fn");
    return result;
  } finally {
    if (in != null) {
     try {
      in.close();
     } catch (IOException e) {
      e.printStackTrace();
     }
    }
  }
}

This is my class CLienteHttp();

private  HttpClient ClienteHttp() {
  if (mHttpCliente == null) {
     public static final int HTTP_TIMEOUT = 30 * 1000; // milliseconds
    mHttpCliente = new DefaultHttpClient();
    final HttpParams params = mHttpCliente.getParams();
    HttpConnectionParams.setConnectionTimeout(params, HTTP_TIMEOUT);
    HttpConnectionParams.setSoTimeout(params, HTTP_TIMEOUT);
    ConnManagerParams.setTimeout(params, HTTP_TIMEOUT);
  }
  return mHttpCliente;
}

And this is my class asyncTask

public class NuevoPostImagen extends AsyncTask<String, Integer, String>{
  @Override
  protected String doInBackground(String... params) {
    objAcceso = new AccesoBd();
    String jsRes="";
    SharedPreferences userDetails = getParent().getSharedPreferences("MisPreferencias", MODE_PRIVATE);
    ArrayList<NameValuePair> ParametrosDeEnvio = new ArrayList<NameValuePair>();
    ParametrosDeEnvio.add(new BasicNameValuePair("from",Integer.toString(userDetails.getInt("Id",0))));
    ParametrosDeEnvio.add(new BasicNameValuePair("idrecurso",Integer.toString(idEvento)));
    ParametrosDeEnvio.add(new BasicNameValuePair("texto","nada"));
    ParametrosDeEnvio.add(new BasicNameValuePair("titulo",txtFTitulo.getText().toString()));
    ParametrosDeEnvio.add(new BasicNameValuePair("imageFile",sImagenBsase64));
    try{
      //here 
      String jes=objAcceso.conxDatosInPost(params[0],ParametrosDeEnvio);
      jsRes = "ok";
    } catch (Exception e) {
      // TODO: handle exception
      e.printStackTrace();
    }finally{return jsRes;}
  }
  @Override
  public void onProgressUpdate(Integer... args){
    Pro.setProgress(args[0]);
  }
  @Override
  protected void onPostExecute( String result) {
    Pro.dismiss();
    if (result.toString().equals("ok")){
      LlenarEvento();
      dOpciones.dismiss();
      dHacerFoto.dismiss();
    }
  }
  @Override
  protected void onPreExecute() {
    Pro = ProgressDialog.show(getParent(), "", "Enviando",true,true);
    Pro.setCancelable(false);
  }
}

Can I update my progress bar with the existing code?

Once the cliente.execute (httpost).

I wonder how I can put a listener or something to check the number of bytes uploaded being updated every second or every time you upload them? I need to update my progress bar, according to the quantity that has been uploaded.

Please, I can help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T04:19:15+00:00Added an answer on June 15, 2026 at 4:19 am

    You can use async task for this. you have to over ride 3 methods.

    doinbackground()
    onpreexecute()
    onpostexecute()
    onProgressUpdate

    i think this will help u to understand hw to do it . How to implement file upload progress bar in android

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Check this code : HTML : <div style="position: absolute; visibility: visible; width: 172px;"> <img
check this out: template <class T> class Test: public T { public: void TestFunc()
Check this code (My Custom Keyboard): -(IBAction) updateTextBackSpace:(id)sender { if([txtview.text length]>0) { NSString *deletedLastCharString
Check this link! I am having the hardest time trying to figure out why
Check this example before reading the question - http://www.sqlfiddle.com/#!2/fcf3e/8 The following data comes from
My web-app has a media upload facility which associates each uploaded media item with
Check this page. On either firefox, chrome, or IE9 / 10 the tabs on
check this example: > a = matrix(1:9, nrow = 3, ncol = 3, dimnames
Check the below code int add(int a, int b) { return a + b;
Check out this jsbin . I have a form with a custom button that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.