android.app.ProgressDialog.incrementProgressBy()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(80)

本文整理了Java中android.app.ProgressDialog.incrementProgressBy()方法的一些代码示例,展示了ProgressDialog.incrementProgressBy()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ProgressDialog.incrementProgressBy()方法的具体详情如下:
包路径:android.app.ProgressDialog
类名称:ProgressDialog
方法名:incrementProgressBy

ProgressDialog.incrementProgressBy介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

final Activity activity = this;

final ProgressDialog progressDialog = new ProgressDialog(activity);
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setCancelable(false);

browser.setWebChromeClient(new WebChromeClient() {
  public void onProgressChanged(WebView view, int progress) {
    progressDialog.show();
    progressDialog.setProgress(0);
    activity.setProgress(progress * 1000);

    progressDialog.incrementProgressBy(progress);

    if(progress == 100 && progressDialog.isShowing())
      progressDialog.dismiss();
  }
});

代码示例来源:origin: androidquery/androidquery

public void increment(int delta){
  
  if(pb != null){		
    pb.incrementProgressBy(unknown ? 1 : delta);
  }
  
  if(pd != null){
    pd.incrementProgressBy(unknown ? 1 : delta);
  }
  
  if(act != null){
    int p;
    if(unknown){
      p = current++;
    }else{
      current+= delta;
      p = (10000 * current) / bytes;
    }
    if(p > 9999){
      p = 9999;
    }
    act.setProgress(p);
  }
  
}

代码示例来源:origin: labexp/osmtracker-android

@Override
  public void transferred(long num) {
    dialog.incrementProgressBy((int) num);
    if (num >= totalSize) {
      // Finish sending. Switch to an indeterminate progress
      // dialog while the OSM server processes the request
      activity.runOnUiThread(new Runnable() {
        @Override
        public void run() {
           dialog.setIndeterminate(true);
           dialog.setCancelable(false);
          dialog.setTitle(activity.getResources().getString(R.string.osm_upload_waiting_response));
        }
      });
    }
    
  }
});

代码示例来源:origin: qiubiteme/android_api_demos

@Override
  public void handleMessage(Message msg) {
    super.handleMessage(msg);
    if (mProgress >= MAX_PROGRESS) {
      mProgressDialog.dismiss();
    } else {
      mProgress++;
      mProgressDialog.incrementProgressBy(1);
      mProgressHandler.sendEmptyMessageDelayed(0, 100);
    }
  }
};

代码示例来源:origin: li2/learning-android-open-source

@Override
  public void handleMessage(Message msg) {
    super.handleMessage(msg);
    if (mProgress >= MAX_PROGRESS) {
      mProgressDialog.dismiss();
    } else {
      mProgress++;
      mProgressDialog.incrementProgressBy(1);
      mProgressHandler.sendEmptyMessageDelayed(0, 100);
    }
  }
};

代码示例来源:origin: stackoverflow.com

dialog.incrementProgressBy(1);

代码示例来源:origin: stackoverflow.com

progressBar.incrementProgressBy(progress[0]);

代码示例来源:origin: stackoverflow.com

ProgressDialog dialog;
 protected void onPreExecute(){
   //example of setting up something
   dialog = new ProgressDialog(your_activity.this);
   dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
   dialog.setMax(100);
   dialog.show();
 }
 @Override
 protected String doInBackground(String... params) {
   for (int i = 0; i < 20; i++) {
     publishProgress(5);
     try {
       Thread.sleep(88);
     } catch (InterruptedException e) {
       e.printStackTrace();
     }
   }
   dialog.dismiss();
   return null;
 }
 protected void onProgressUpdate(Integer...progress){
   dialog.incrementProgressBy(progress[0]);
 }

代码示例来源:origin: stackoverflow.com

final ProgressDialog pDialog = new ProgressDialog(context);
pDialog.setMessage("Please wait....");
pDialog.setCancelable(false);
pDialog.show();

String url = "url";

final Activity activity = (Activity) context;
pdfView.setWebChromeClient(new WebChromeClient() {
  public void onProgressChanged(WebView view, int progress)   
  {
    activity.setProgress(progress * 1000);
    pDialog.incrementProgressBy(progress);
    if(progress == 100 && pDialog.isShowing()) 
      pDialog.dismiss();
  }
});

代码示例来源:origin: labexp/osmtracker-android

@Override
protected void onProgressUpdate(Long... values) {
  if (values.length == 1) {
    // Standard progress update
    dialog.incrementProgressBy(values[0].intValue());
  } else if (values.length == 3) {
    // To initialise the dialog, 3 values are passed to onProgressUpdate()
    // trackId, number of track points, number of waypoints
    dialog.dismiss();
    
    dialog = new ProgressDialog(context);
    dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    dialog.setIndeterminate(false);
    dialog.setCancelable(false);
    dialog.setProgress(0);
    dialog.setMax(values[1].intValue() + values[2].intValue());
    dialog.setTitle(
        context.getResources().getString(R.string.trackmgr_exporting)
        .replace("{0}", Long.toString(values[0])));
    dialog.show();
  }
}

代码示例来源:origin: sarbajitsaha/Batch-Uninstaller

@Override
  protected void onPostExecute(Boolean result) {
    if (result) {
      progressDialog.setMessage("Uninstalled " + pkg.packageName);
      progressDialog.incrementProgressBy(1);
      // Toast.makeText(getApplicationContext(),, Toast.LENGTH_SHORT).show();
      for (int i = 0; i < mApps.size(); i++) {
        if (mApps.get(i).packageName.compareTo(pkg.packageName) == 0) {
          mApps.remove(i);
          mAdapter.notifyDataSetChanged();
        }
      }
    } else {
      progressDialog.incrementProgressBy(1);
      Toast.makeText(getApplicationContext(), "Failed to uninstall "
          + pkg.packageName, Toast.LENGTH_SHORT).show();
      for (int i = 0; i < mApps.size(); i++) {
        if (mApps.get(i).packageName.compareTo(pkg.packageName) == 0) {
          mApps.get(i).color = R.color.backgroundPrimary;
          mAdapter.notifyDataSetChanged();
        }
      }
    }
    super.onPostExecute(result);
  }
});

代码示例来源:origin: com.googlecode.android-query/android-query

public void increment(int delta){
  
  if(pb != null){		
    pb.incrementProgressBy(unknown ? 1 : delta);
  }
  
  if(pd != null){
    pd.incrementProgressBy(unknown ? 1 : delta);
  }
  
  if(act != null){
    int p;
    if(unknown){
      p = current++;
    }else{
      current+= delta;
      p = (10000 * current) / bytes;
    }
    if(p > 9999){
      p = 9999;
    }
    act.setProgress(p);
  }
  
}

代码示例来源:origin: stackoverflow.com

try{
  Thread.sleep(1000);
  progressBarDialog.incrementProgressBy((int)(5));

代码示例来源:origin: ABTSoftware/SciChart.Android.Examples

progressDialog.incrementProgressBy(1);

代码示例来源:origin: stackoverflow.com

barProgressDialog.incrementProgressBy(2);

代码示例来源:origin: stackoverflow.com

@Override
public void run() {
  barraProgreso.incrementProgressBy(1);

代码示例来源:origin: stackoverflow.com

public void handleMessage(Message msg) {
 super.handleMessage(msg);
 progressDoalog.incrementProgressBy(1);

代码示例来源:origin: stackoverflow.com

updateBarHandler.post(new Runnable() {
  public void run() {
    barProgressDialog.incrementProgressBy(2);

代码示例来源:origin: stackoverflow.com

barProgressDialog.incrementProgressBy(2);

代码示例来源:origin: netmackan/ATimeTracker

@Override
protected void onProgressUpdate(Integer... vs) {
  switch (vs[0]) {
    case PRIMARY:
      if (vs[1] == 0) {
        progressDialog.setProgress(0);
      } else {
        progressDialog.incrementProgressBy(vs[1]);
      }
      break;
    case SECONDARY:
      if (vs[1] == 0) {
        progressDialog.setSecondaryProgress(0);
      } else {
        progressDialog.incrementSecondaryProgressBy(vs[1]);
      }
      break;
    case SETMAX:
      progressDialog.setMax(vs[1]);
      break;
    default:
      break;
  }
}

相关文章