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

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

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

ProgressDialog.setMax介绍

暂无

代码示例

代码示例来源:origin: WVector/AppUpdate

public static void setMax(long total) {
  if (sHorizontalProgressDialog != null) {
    sHorizontalProgressDialog.setMax(((int) total) / (1024 * 1024));
  }
}

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

ProgressDialog progressBar = new ProgressDialog(getContext());
int max = getContext().getResources().getInteger(R.integer.maximum);
progressBar.setMax(max);

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

public void setBytes(int bytes){
  
  if(bytes <= 0){
    unknown = true;
    bytes = 10000;
  }
  
  this.bytes = bytes;
  
  if(pb != null){
    pb.setProgress(0);
    pb.setMax(bytes);
  }
  if(pd != null){
    pd.setProgress(0);
    pd.setMax(bytes);
  }
  
  
}

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

ProgressDialog mProgressDialog = new ProgressDialog(Your_Activity.this);
mProgressDialog.setMessage("Here you can set a message");
mProgressDialog.setIndeterminate(false);
mProgressDialog.setMax(100);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.show();
MyAsyncTask obj = new MyAsyncTask ();
obj.execute("url");

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

public void reset(){
  
  if(pb != null){
    pb.setProgress(0);
    pb.setMax(10000);
  }
  if(pd != null){
    pd.setProgress(0);
    pd.setMax(10000);
  }
  
  if(act != null){
    act.setProgress(0);
  }
  unknown = false;
  current = 0;
  bytes = 10000;
  
}

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

mProgressDialog.setMessage("Downloading file..");
mProgressDialog.setIndeterminate(false);
mProgressDialog.setMax(100);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.setCancelable(true);

代码示例来源:origin: WVector/AppUpdate

public static void onLoading(long total, long current) {
    if (sHorizontalProgressDialog == null) {
      return;
    }
    if (current == 0) {
      sHorizontalProgressDialog.setMax(((int) total) / (1024 * 1024));
    }
    sHorizontalProgressDialog.setProgress(((int) current) / (1024 * 1024));
    if (sHorizontalProgressDialog.getProgress() >= sHorizontalProgressDialog.getMax()) {
      sHorizontalProgressDialog.dismiss();
      sHorizontalProgressDialog = null;
    }
  }
}

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

pDialog.setMessage("Downloading file. Please wait...");
pDialog.setIndeterminate(false);
pDialog.setMax(100);
pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
pDialog.setCancelable(true);

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

dialog.setMessage("Downloading and uncompressing " + downloadURL);
dialog.setIndeterminate(false);
dialog.setMax(100);
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
dialog.show();

代码示例来源:origin: k9mail/k-9

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
  Bundle args = getArguments();
  long size = args.getLong(ARG_SIZE);
  String message = args.getString(ARG_MESSAGE);
  final SizeUnit sizeUnit = SizeUnit.getAppropriateFor(size);
  messagingListener = new SimpleMessagingListener() {
    @Override
    public void updateProgress(int progress) {
      dialog.setProgress(sizeUnit.valueInSizeUnit(progress));
    }
  };
  messagingController = MessagingController.getInstance(getActivity());
  messagingController.addListener(messagingListener);
  dialog = new ProgressDialog(getActivity());
  dialog.setMessage(message);
  dialog.setMax(sizeUnit.valueInSizeUnit(size));
  dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
  dialog.setProgress(0);
  dialog.setProgressNumberFormat("%1d/%2d " + sizeUnit.shortName);
  dialog.show();
  return dialog;
}

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

@Test
public void shouldSetMax() {
 assertThat(dialog.getMax()).isEqualTo(0);
 dialog.setMax(41);
 assertThat(dialog.getMax()).isEqualTo(41);
}

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

public class BackgroundTask extends AsyncTask<String, Integer, String >{
   private ProgressDialog mProgressDialog;
   int progress;
   public BackgroundTask() {
     mProgressDialog = new ProgressDialog(context);
      mProgressDialog.setMax(100);
      mProgressDialog.setProgress(0);
 }
   @Override
 protected void onPreExecute() {
     mProgressDialog =ProgressDialog.show(context, "", "Loading...",true,false);
   super.onPreExecute();
 }
  @Override
  protected void onProgressUpdate(Integer... values) {
  setProgress(values[0]);
}
 @Override
 protected String doInBackground(String... params) {
     String data=getDatafromMemoryCard();    
   return data;  // return data you want to use here
 }
 @Override
 protected void onPostExecute(String  result) {  // result is data returned by doInBackground
   Toast.makeText(context, result, Toast.LENGTH_LONG).show();
   mProgressDialog.dismiss();
   super.onPostExecute(result);
 }
 }

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

mProgressDialog.setMessage("Downloading");
mProgressDialog.setIndeterminate(false);
mProgressDialog.setMax(100);
mProgressDialog.setCancelable(true);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);

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

mPDialog.setMax(100);
mPDialog.setProgress(progress[0]);

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

protected void onPreExecute() {
 ProgressDialog myDialog = new ProgressDialog(context);
 myDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
 myDialog.setMax(maxValue);
 myDialog.show();
}

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

ProgressDialog dialog;
 @Override
 protected void onPreExecute() {
   super.onPreExecute();
   dialog = new ProgressDialog(FileOperations.this);
   dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
   dialog.setMax(100);
   dialog.show();
 }

代码示例来源:origin: redfish64/TinyTravelTracker

@Override
  public void run() {
    fragment.dialog.setMax(end - start);
    fragment.dialog.setProgress(progress - start);
  }
});

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

ProgressDialog mProgressDialog = new ProgressDialog(YourActivity.this);
mProgressDialog.setMessage("A message");
mProgressDialog.setIndeterminate(false);
mProgressDialog.setMax(100);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
DownloadFile downloadFile = new DownloadFile();
downloadFile.execute("the url to the file you want to download");

代码示例来源:origin: jp1017/ActivityLauncher

@Override
protected void onProgressUpdate(Integer... values) {
  if(this.progress != null && values.length > 0) {
    int value = values[0];
    
    if(value == 0) {
      this.progress.setIndeterminate(false);
      this.progress.setMax(this.max);
    }
    
    this.progress.setProgress(value);
  }
}

代码示例来源:origin: BasicAirData/GPSLogger

@Override
protected void onProgressUpdate(Integer... progress) {
  super.onProgressUpdate(progress);
  // if we get here, length is known, now set indeterminate to false
  mProgressDialog.setIndeterminate(false);
  mProgressDialog.setMax(2028);
  mProgressDialog.setProgress(progress[0]);
}

相关文章