Android studio Java извлечение ответа HTTP из MultipartUploadRequest - PullRequest
0 голосов
/ 21 апреля 2020

У меня проблемы с получением ответа от моего HTTP-запроса ... Я не знаю, где и как выполнить функцию "onResponde ()", которая есть в обычных запросах ...

Вот мой код:

public void uploadMultipart() {
    //getting name for the image
    String name = this.name.getText().toString().trim();

    //getting the actual path of the image
    //getting the actual path of the image
    String path = getPath(filePath);

    //Uploading code
    try {
        String uploadId = UUID.randomUUID().toString();
        String key = new StringBuilder(load()).reverse().toString();

        //Creating a multi part request
        new MultipartUploadRequest(this, uploadId, "http://pic1world.aaa/somelink")
                .addFileToUpload(path, "image") //Adding file
                .addParameter("username", name) //Adding text parameter to the request
                .addParameter("auth_key", key) //Adding text parameter to the request
                .setNotificationConfig(new UploadNotificationConfig())
                .setMaxRetries(2) 

                .startUpload(); //Starting the upload


    } catch (Exception exc) {
        Toast.makeText(this, exc.getMessage(), Toast.LENGTH_SHORT).show();
    }
}
...