[英]Android HttpResponse not generic
我收到错误消息: The type HttpResponse is not generic; it cannot be parameterized with arguments <JsonNode>
The type HttpResponse is not generic; it cannot be parameterized with arguments <JsonNode>
在正常的Java中,它可以工作,但在Android中,不是吗?
try
{
HttpResponse<JsonNode> jsonResponse = Unirest.post("http://example.com/example.php")
.field("sender", sender)
.field("body", body)
.asJson();
System.out.println(jsonResponse.getBody().toString());
}
catch(Exception e)
{
System.out.println(e);
}
进口:
import org.apache.http.HttpResponse;
import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.Unirest;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.Window;
import android.widget.EditText;
您需要import com.mashape.unirest.http.HttpResponse;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.