下面的代码从服务器获取数据,但无法转换为列表
此代码显示错误 java.util.HashMap 无法转换为 com.tesla.developer.teslatvinverters.BackendlessClasses.InvertersData 相同的代码适用于其他无后端类
Backendless.Data.of(InvertersData.class).find(new AsyncCallback<BackendlessCollection<InvertersData>>() {
@Override
public void handleResponse(BackendlessCollection<InvertersData> inverterData) {
// all Contact instances have been found
// error is in the Toast when i try to get id of object , but it gives the size of data accurate
List<InvertersData> allData = inverterData.getData();
Toast.makeText(MainActivity.this, "" +allData.get(0).getObjectId(),Toast.LENGTH_SHORT).show();
// iterate over the received objects
Iterator<InvertersData> iterator = allData.iterator();
while( iterator.hasNext())
{
Log.e("Object :", ""+iterator.next().getObjectId());
}
}
});