Search code examples
androidandroid-layoutandroid-ion

progress dialogue not showing with the library koush/ion


This is my code. The problem is the progress dialogue is not showing, so the default text on the text view is showing and after some time the URL content is loaded into it. How can I fix this?

tv = (TextView) findViewById(R.id.textView1);
pd = new ProgressDialog(MainActivity.this);
Ion.with(getBaseContext()).load("https://google.com")
.progressDialog(pd)
.asString()
.setCallback(new FutureCallback() {

        @Override
        public void onCompleted(Exception arg0, String arg1) {
            // TODO Auto-generated method stub
            tv.setText(arg1);
        }
    });

Solution

  • I posted this issues on github and got this response from user kouch

    Must call show/cancel yourself.

    This is because the progress dialog may be linked to further work/progress, or show errors, etc. I left management of the dialog up to the callee. Leaves room for flexibility.