我正在使用azure sdk for android并按照教程https://azure.microsoft.com/en-us/documentation/articles/mobile-services-dotnet-backend-android-get-started-data/ . 当我尝试连接并将数据插入移动服务表时,一切正常,但是当我在活动中查询表时,我的应用程序卡住了,尽管表中只有几个条目,并且execute方法成功返回Future .

public static MobileServiceClient mClient;

public static void connect(Context context) {
    try {
        mClient = new MobileServiceClient(storageLink, key, context);
    } catch (MalformedURLException e) {
        Log.e("AzureService.connect", "Storage access failed" + storageLink);
    }
}

public static InstallationData get(final String deviceId) {
    MobileServiceTable<InstallationData> table= mClient.getTable(InstallationData.class);
    final MobileServiceList<InstallationData> result;
    try {
        result = table.where().field("deviceid").eq(deviceId).execute().get();
        for (InstallationData item : result) {
           return item;
        }
    } catch (InterruptedException e) {
        e.printStackTrace();
    } catch (ExecutionException e) {
        e.printStackTrace();
    }
    return null;
}

public static void store(final InstallationData item) {
    mClient.getTable(InstallationData.class).insert(item, new TableOperationCallback<InstallationData>() {
        public void onCompleted(InstallationData entity, Exception exception, ServiceFilterResponse response) {
            if (exception == null) {
                Log.d("AzureService.store()", "Data about " + item.getDeviceid() + "" + "is successfully updated");
            } else {
                exception.printStackTrace();
                Log.e("AzureService.store()", "Data about " + item.getDeviceid() + "" + "is failed to update");
            }
        }
    });
}

先感谢您!