Несовместимые типы: ReceieveMessageDataModel не может быть преобразовано в строку - PullRequest
0 голосов
/ 11 июня 2018

Проект должен POST данные при нажатии на кнопку.Но есть ошибка:

несовместимые типы: ReceieveMessageDataModel не может быть преобразовано в строку.

Я пытаюсь преобразовать ArrayList в String, но возникает эта ошибка.Только что попробовал некоторые решения от StackOverflow и с других сайтов.Но я пока не могу найти решение этой ошибки.

Эта функция отправки сообщения запускается в onClick кнопки.

protected void postMessage(){
        Call<ReceieveMessageModel> call = ApiService.apiInterface.postMessage(authorization,
                categoryId.toString().trim(), questionId.toString().trim(), answerId.toString().trim(), Loc.toString().trim());

        call.enqueue(new Callback<ReceieveMessageModel>() {
            @Override
            public void onResponse(Call<ReceieveMessageModel> call, Response<ReceieveMessageModel> response) {
                stopProgress();

                if (response.isSuccessful()){

                    if (response.body() != null){

    DialogHelper.showDialogWithOneButton("",response.body().getData());
                    }
                }
                else {
                    ApiErrorUtils.parseError(response);
                }
            }

            @Override
        public void onFailure(Call<ReceieveMessageModel> call, Throwable t)           
   {

                stopProgress();
                DialogHelper.showFailedDialog();
            }
        });
    }

MessageModel.java

 package com.example.gokhan.emasapps.model;

 public class MessageModel {
 private  String Id;
 private  String Title;
  private String Description;

  public String getDescription() {
    if (Description == null){
        Description = "";
    }

    return Description;
}

public void setDescription(String description) {
    Description = description;
}

public String getId() {

    return Id;
}

public void setId(String id) {
    Id = id;
}

public String getTitle() {
    return Title;
}

public void setTitle(String title) {
    Title = title;
}
}

ReceieveMessageDataModel.java

 public class ReceieveMessageDataModel {

private MessageModel Question;
private ArrayList<MessageModel> Answers;
private MessageModel Category;

public MessageModel getQuestion() {
    return Question;
}

public void setQuestion(MessageModel question) {
    Question = question;
}

public ArrayList<MessageModel> getAnswers() {
    return Answers;
}

public void setAnswers(ArrayList<MessageModel> answers) {
    Answers = answers;
}

public MessageModel getCategory() {
    return Category;
}

public void setCategory(MessageModel category) {
    Category = category;
}

Ошибка в этом коде:

DialogHelper.showDialogWithOneButton("",response.body().getData());

Пожалуйста, помогите мне!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...