繁体   English   中英

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

[英]Loading Dialog, Progress Dialog on Button Click

嗨我想首先显示加载或进度对话1秒钟,然后按钮做其他事情....请帮忙

    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();
            }

就这样做,它会起作用。

    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 

            }
        });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM