Search code examples
androidbackendless

Cannot resolve method


I am trying to get to show my "Uploads" folder on my Android Studio project from my Backendless files.

This is the code:

Backendless.Files.listing("/Uploads", "*.docs", true, new AsyncCallback<BackendlessCollection<FileInfo>>() {
            @Override
            public void handleResponse(BackendlessCollection<FileInfo> response) {
                Iterator<FileInfo> filesIterator = response.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();
                }
            }

When I run the code I get these errors:

Error:(34, 38) error: cannot find symbol method getURL()
Error:(35, 44) error: cannot find symbol method getPublicUrl()
Error:(36, 51) error: cannot find symbol method getCreatedOn()
Error:(37, 39) error: cannot find symbol method getName()
Error:(28, 63) error: incompatible types: <anonymous AsyncCallback<BackendlessCollection<com.example.francis.classdroid.FileInfo>>> cannot be converted to AsyncCallback<BackendlessCollection<com.backendless.files.FileInfo>>

Solution

  • The problem here is in incorrect import of FileInfo class. Make sure you have imported com.backendless.files.FileInfo.

    If you do not know what is import in Java, you can read more here. The imports in Java are placed at the top of the file.