Ayrton Werck
Ayrton Werck

Reputation: 344

onCompleted method

I would like to get the result of a query done with windows azure.

private boolean checkIfExist(Client c)
{
    this.clientTable.where().field("id").eq(c.getId())
        .execute(new TableQueryCallback<Client>()
        {
            @Override
            public void onCompleted(List<Client> arg0, int arg1,
                    Exception arg2, ServiceFilterResponse arg3)
            {
                //if (arg0.size() >= 1)
                    Global.getInstance().exist = true;
            }
        });

    if (Global.getInstance().exist == true)
    {
        Global.getInstance().exist = false;
        return true;
    }
    else
    {
        return false;
    }
}

I know that work however as it is a web request it take a while. I wonder how to make a wait until it goes on onCompleted method and then I could deal with my data.

Upvotes: 1

Views: 132

Answers (1)

osayilgan
osayilgan

Reputation: 5893

I don't know how it works but as far as I see it looks asynchronous already. But if it is not, then you can create a thread and make your request there in the background. After it finishes you can send your data to the Main Thread with an handler.

Here you can find a small example to understand how it works.

Upvotes: 1

Related Questions