Start a new topic

Progress dialog not working when run onSuccess

Sorry if this has been asked before but I cannot find the answer for this (I have searched!)

Before the start get(q, new KinveyListCallback<EventEntity>(), i have displayed Progressdialog. But during run onSuccess, Progressdialog not working (ProgressBar in Progressdialog not spin). Is there a way to fix this? Thanks


Hi,


Are you able to fetch data from Kinvey Datastore properly? Also, can you try to comment out the Kinvey related code and see if you can get asyncDialog/ ProgressDialog to show properly?



Regards,

Wani

 This is my code.  My onSuccess(Entity[] result) processing takes longer. when applications run  onSuccess, progressbar in progressdialog not spin and dialog still display. I don't understand why. Help me! 

final ProgressDialog asyncDialog = new ProgressDialog(getActivity());
asyncDialog.setMessage("Restore...");
asyncDialog.show();

Query myQuery = kinveyClient.query();
            myQuery.equals("user_id",MyID);

            kinveyClient.appData(DATABASE_CLOUD, Entity.class).get(myQuery, new KinveyListCallback<Entity>() {
                @Override
                public void onSuccess(Entity[] result) {

                    //Toast.makeText(getActivity(), "query Worked!\n Got: " + result.length, Toast.LENGTH_LONG).show();
                    for (int i = 0; i < result.length; i++) {
                            values.put(Telephony.Sms.ADDRESS, result[i].getAddress());
                            values.put(Telephony.Sms.DATE, result[i].getDate());
                            values.put(Telephony.Sms.TYPE, result[i].getType());
                        values.put(Telephony.Sms.BODY, result[i].getBody());
                           values.put(Telephony.Sms.SERVICE_CENTER, result[i].getService_center());
                        values.put(Telephony.Sms.READ, result[i].getRead());
                        values.put(Telephony.Sms.STATUS, result[i].getStatus());
                        values.put(Telephony.Sms.LOCKED, result[i].getLocked());
                            values.put(Telephony.Sms.PROTOCOL, result[i].getProtocol());
                       
                        getActivity().getContentResolver().insert(Uri.parse("content://sms/"), values);
                        values.clear();
                    }

                    if (asyncDialog.isShowing()) {
                        asyncDialog.dismiss();
                    }
                    Log.i("TAGGG" , "on Post Execute restore ");
                    Toast.makeText(getActivity(), "Restore success" , Toast.LENGTH_SHORT).show();
                }

                @Override
                public void onFailure(Throwable error) {
                    Log.i("TAGGG", "AppData.get by Query Failure", error);
                    //  Toast.makeText(MainActivity.this, "restore Failed!\n " + error.getMessage(), Toast.LENGTH_LONG).show();
                }
            });

     

Hi,


Can you please share more of your code? I didn't completely get the problem you are facing.



Regards,

Wani

Kinvey Support

Login or Signup to post a comment