我正在使用 backendless,我正在尝试在列表视图中显示我的目录。我正在使用安卓工作室。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Backendless.setUrl(Defaults.SERVER_URL);
Backendless.initApp(this, Defaults.APPLICATION_ID, Defaults.SECRET_KEY, Defaults.VERSION);
Backendless.Files.listing("/Uploads", "*docs", true, new AsyncCallback<BackendlessCollection<FileInfo>>() {
@Override
public void handleResponse(BackendlessCollection<FileInfo> fileInfoBackendlessCollection) {
Iterator<FileInfo> filesIterator = fileInfoBackendlessCollection.getCurrentPage().iterator();
while (filesIterator.hasNext()) {
FileInfo file = filesIterator.next();
String URL = file.getURL();
String publicURL = file.getPublicUrl();
Date createdOn = new Date(file.getCreatedOn());
String name = file.getName();
String[] info = {URL, publicURL, name};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getListView().getContext(), android.R.layout.simple_list_item_1, info);
getListView().setAdapter(adapter);
}
}
@Override
public void handleFault(BackendlessFault backendlessFault) {
}
});
}
}
它没有错误,但应用程序无法打开。谁能帮我做什么?