No Progress Spinner in ProgressDialog
Asked Answered
G

3

3

I am trying to create a ProgressDialog as seen in just about every app on the Play Store now. I am using the code:

getActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                ProgressDialog dialog;
                dialog = ProgressDialog.show(getActivity(), "title", "message", true, false);
            }
        });

I have also tried with just the 2 lines inside the Runnable (without creating a thread) from inside a fragment and no matter what I do I can't see the spinner in the ProgressDialog. I'm attaching a screenshot so that you can see what I mean. Somebody PLEASE help me.

Running Android 5.1.1 on a Galaxy S6, all stock OS.

EDIT: Imports are:

import android.app.Fragment;
import android.app.ProgressDialog;

enter image description here

Gattis answered 4/10, 2015 at 23:43 Comment(3)
show us your importsOmnipotence
try to remove the both boolean and set it VIA object call.Omnipotence
@Omnipotence I tried this, and it didn't work either.Gattis
S
3

Check with style you use res/values/style and add new or change color

styles.xml

  <style name="MyDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
        <item name="colorPrimary">@color/orange</item>
    </style>

actyity

ProgressDialog progressDialog = new ProgressDialog(ProfilActivity.this,R.style.MyDialogTheme);

Sylvia answered 31/3, 2018 at 15:55 Comment(0)
S
0

Try this

    ProgressDialog progressDialog = new ProgressDialog(context);
    progressDialog.setMessage("[YOUR MESSAGE]");
    progressDialog.setCancelable(true); // Check as required
    progressDialog.show();
Selry answered 5/10, 2015 at 0:8 Comment(1)
This wasn't successful, it seems like just another way to do what I'm already doing...Gattis
E
0

If you are in a fragment use getActivity() instead of this

            ProgressDialog progressDialog = new ProgressDialog(getActivity());
            progressDialog.setMessage("[YOUR MESSAGE]");
            progressDialog.setCancelable(true); // Check as required
            progressDialog.show();*/

This one work for me :)

Eames answered 8/10, 2015 at 18:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.