android开发中写一个alertdialog类,让其集成自Dialog,请问在复写他onclick方法时,点击确认按钮后, 5
publicclassDialogCourseGetextendsDialogimplementsandroid.view.View.OnClickListener{pr...
public class DialogCourseGet extends Dialog implements android.view.View.OnClickListener{
private Context context;
private Button button;
private ImageView imageView;
private TextView textView;
private WebView webView;
public DialogCourseGet(Context context) {
super(context);
this.context=context;
// TODO Auto-generated constructor stub
}
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(com.zjnewwork.goodschool.R.layout.alertdialog_code_course);
imageView=(ImageView) findViewById(R.id.course_code);
textView=(TextView) findViewById(R.id.course_code_write);
button=(Button) findViewById(R.id.course_alertdialog_ok);
webView=(WebView) findViewById(R.id.webView_dialog);
button.setOnClickListener(this);
//下面的代码主要是设置dialog的大小
DisplayMetrics Metrics = new DisplayMetrics();
((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(Metrics);
LayoutParams params = getWindow().getAttributes();
params.width = (int) (Metrics.widthPixels* 0.9);
getWindow().setAttributes(params);
getWindow().setGravity(Gravity.CENTER);
//获取验证码
new AsyncTask<String, Void, Bitmap>() {
protected Bitmap doInBackground(String... params) {
try {
Bitmap bitMap = CourseAction.Get_CourseCode(Parameters.CODE_URL, 1);
return bitMap;
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Bitmap result) {
imageView.setImageBitmap(result);
super.onPostExecute(result);
}
}.execute();
}
public void onClick(View v) {
//我想要,点击确认按钮后,alertdialog消失,出现progressdialog。
this.dismiss();
} 展开
private Context context;
private Button button;
private ImageView imageView;
private TextView textView;
private WebView webView;
public DialogCourseGet(Context context) {
super(context);
this.context=context;
// TODO Auto-generated constructor stub
}
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(com.zjnewwork.goodschool.R.layout.alertdialog_code_course);
imageView=(ImageView) findViewById(R.id.course_code);
textView=(TextView) findViewById(R.id.course_code_write);
button=(Button) findViewById(R.id.course_alertdialog_ok);
webView=(WebView) findViewById(R.id.webView_dialog);
button.setOnClickListener(this);
//下面的代码主要是设置dialog的大小
DisplayMetrics Metrics = new DisplayMetrics();
((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(Metrics);
LayoutParams params = getWindow().getAttributes();
params.width = (int) (Metrics.widthPixels* 0.9);
getWindow().setAttributes(params);
getWindow().setGravity(Gravity.CENTER);
//获取验证码
new AsyncTask<String, Void, Bitmap>() {
protected Bitmap doInBackground(String... params) {
try {
Bitmap bitMap = CourseAction.Get_CourseCode(Parameters.CODE_URL, 1);
return bitMap;
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Bitmap result) {
imageView.setImageBitmap(result);
super.onPostExecute(result);
}
}.execute();
}
public void onClick(View v) {
//我想要,点击确认按钮后,alertdialog消失,出现progressdialog。
this.dismiss();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询