package com.jqyd.pub; import com.jqyd.manager.R; import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; public class MyProgressDialog extends AlertDialog{ Context context; TextView percent; TextView number; ProgressBar progress; int percentnum; int num; int maxnum; public MyProgressDialog(Context context){ super(context); this.context = context; LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.alert_dialog_progress, null); percent = (TextView) view.findViewById(R.id.progress_percent); number = (TextView) view.findViewById(R.id.progress_number); progress = (ProgressBar) view.findViewById(R.id.progress); setView(view); } /** * @param titlestr the titlestr to set */ public void setProgress(int Progressnum) { this.num = Progressnum; Log.e("xiao", "setProgress__________"+maxnum); percentnum = (Progressnum*100)/maxnum; percent.setText(percentnum+"%"); number.setText(Progressnum+"KB"+"/"+maxnum+"KB"); progress.setProgress(Progressnum); } public void setMax(int max){ this.maxnum=max; progress.setMax(max); } /** * @return the numstr */ }