我想要 String s1Value;
s1.setAdapter(adapter);
s1.setOnItemSelectedListener(
new OnItemSelectedListener() {
public void onItemSelected(
AdapterView<?> parent, View view, int position, long id) {
s1Value = adapter.get(position);
}
public void onNothingSelected(AdapterView<?> parent) {
s1Value = "";
}
});
次请求。但我也希望通过它来传递很多参数。当我正在做一个帖子时,我这样做:
MultipartFormDataContent
这很完美。但现在我也想用它传递一个图像。 我找到了很多例子,但总是没有额外的参数。 有人可以帮忙吗?
答案 0 :(得分:1)
请尝试以下代码:
HttpClient httpClient = new HttpClient();
MultipartFormDataContent content = new MultipartFormDataContent();
content.Add(new StringContent(parameter), "name");
content.Add(new StreamContent(stream), "param", "filename");
HttpResponseMessage httpResponseMessage = await httpClient.PostAsync(address, content);