加载对话框,单击按钮时的进度对话框

编程入门 行业动态 更新时间:2024-10-26 02:28:26
本文介绍了加载对话框,单击按钮时的进度对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想先显示加载或进度对话框 1 秒,然后按钮执行其他任何操作....请帮忙

Hi i want to show a loading or progress dialog first for 1 second before button do anything else.... please help

button1 = (Button) findViewById(R.id.button1); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { <!-- want to a Show a Loading or Progress Dailog for 1 Second --> if (isInternetPresent) { // Internet Connection is Present } else { // Internet connection is not present InternetNotContectedAlert(); }

推荐答案

就这样去做,它会起作用.

Just do it like this,it will work.

ProgressDialog csprogress=new ProgressDialog(NextActivity.this); Button csButton=(Button)findViewById(R.id.txtx); csButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { csprogress.setMessage("Loading..."); csprogress.show(); new Handler().postDelayed(new Runnable() { @Override public void run() { csprogress.dismiss(); //whatever you want just you have to launch overhere. } }, 1000);//just mention the time when you want to launch your action } });

更多推荐

加载对话框,单击按钮时的进度对话框

本文发布于:2023-08-06 13:14:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1312631.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:对话框   单击   进度   按钮   加载

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!