0

Androidアプリケーションでksoapを使用してデータをダウンロードするときに、水平プログレスバーに進行状況を表示するにはどうすればよいですか?

ここでは、サーバーからデータをフェッチするために AsyncTask を使用しています。同時に、転送されたデータと転送されるデータに応じて、水平プログレスバーの進行状況を示す必要があります。

private class SyncIncoData extends AsyncTask<String, Void, String> {
        ProgressBar pb;
        LinearLayout all;
        @Override
        protected String doInBackground(String... urls) {
            try {
                incodata=si.GetSoapData();
                db=new SqlConnector(con);
                datacheckerInco(incodata);
            } catch (Exception e) {

                e.printStackTrace();
            }

            return null;
        }

        @Override
        protected void onPreExecute() {
            // TODO Auto-generated method stub
            super.onPreExecute();
            all=(LinearLayout)findViewById(R.id.linearLayoutall);
            all.setEnabled(false);
            pb=(ProgressBar)findViewById(R.id.progressBarsync4);
            pb.setVisibility(View.VISIBLE);
            back=false;
            saleto.setClickable(false);
            shipto.setClickable(false);
            mate.setClickable(false);
            inco.setClickable(false);
            off.setClickable(false);
            tv4.setText("Synchronizing");
            //im4.setVisibility(View.INVISIBLE);
        }

        @Override
        protected void onPostExecute(String result) {
            all=(LinearLayout)findViewById(R.id.linearLayoutall);
            all.setEnabled(true);
            pb=(ProgressBar)findViewById(R.id.progressBarsync4);
            pb.setVisibility(View.INVISIBLE);
            back=true;
            saleto.setClickable(true);
            shipto.setClickable(true);
            mate.setClickable(true);
            inco.setClickable(true);
            off.setClickable(true);
            tv4.setText("Completed");
            //im4.setVisibility(View.VISIBLE);
        }
    }
4

1 に答える 1

0

これを見てください:https ://sites.google.com/site/androidhowto/how-to-1/create-a-custom-progress-bar-using-asynctask

于 2012-04-03T10:46:38.747 に答える