Search code examples
javaandroidcloudboost

Problems in saving data with Android on CloudBoost


I'm using CloudBoost for Android application and i had some problems when I try to save save a data in a table, I'm not getting any results. This is my code:

CloudApp.init("*****", "*****");
...
new Thread(new Runnable() {
                    @Override
                    public void run() {
                        CloudObject obj = new CloudObject("User", "1uvSDThQ");
                        Log.e("LOG", "1"); //Already this is not shown
                        try {
                            obj.set("color", "#000000");
                            obj.setAcl(new ACL());
                            obj.save(new CloudObjectCallback() {
                                @Override
                                public void done(final CloudObject x, final CloudException e) {

                                    if(e != null)
                                        //error
                                        Log.e("LOG", "Errore");
                                    if(x!=null)
                                        //cloudObject
                                        Log.e("LOG", "FATTO");


                                }
                            });
                        } catch (CloudException e) {
                            e.printStackTrace();
                        }

                    }
                });

Solution

  • Your log isn't shown because you made a Thread without calling start().

    Android typically uses Asynctask anyway, but I'm not sure why you really need a Thread with this library... That save method looks asynchronous

    CloudApp.init("*****", "*****")
    CloudObject obj = new CloudObject("User", "1uvSDThQ");
    Log.e("LOG", "1"); 
    try {
        obj.set("color", "#000000");
        obj.setAcl(new ACL());
        obj.save(new CloudObjectCallback() {
            @Override