我正在尝试将editText中的文本发送到我的WCF。它似乎在大多数时候都很好用,但是当我写下例如:" Hello"然后按键盘上的Enter键并继续写一些我收到错误:IllegalArgumentException:索引156处的非法字符。当我按下键盘输入时。 (当我不使用enterbutton时,整个过程都有效)
我仍然希望我的EditText是多线的。
当用户输入包含enterclick的内容时,如何将文本发送到我的wcf,我该怎么办?
我可以删除按钮并将其替换为"下一步" och"完成"?
我试图用
替换它invoiceText = invoiceText.replace("/n", "//n");
但没有成功。
我的editText:
<EditText
android:id="@+id/descriptionEditText"
android:layout_width="wrap_content"
android:layout_height="340dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/InputTextTitle"
android:layout_marginTop="35dp"
android:inputType="textMultiLine"
android:gravity="top|left" >
</EditText>
这是我连接/写入WCF的方式:(这是_phoneDAL中的RegisterTime)
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(URL + "/RegisterTime?userName=" + userName + "&customerId=" + customerID + "&timeInvoiced=" + timeInvoice + "&timeWorked=" + timeWork + "&date=" + date + "&invoiceText=" + invoiceText);
HttpResponse httpResponse = httpClient.execute(httpGet);
HttpEntity httpEntity = httpResponse.getEntity();
InputStream stream = httpEntity.getContent();
String result = converter(stream);
Log.v("Result registerTime", result);
if(result != "-1" && result != "0"){
return true;
}
_phoneDAL.registerTime(id, timeDiffWorkTime, Integer.parseInt(_userName), selectedCustomer, timeDiffInvoiced, selectedDate, description);