'的readLine()'被弃用的人少了...
这是我在android studio中使用readLine()时显示的错误。可以使用什么
DataInputStream in = new DataInputStream(client.getInputStream());
String line = null;
while((line = in.*readLine()*) != null)
{
msg = msg + "\n Client : " + line;
handler.post(new Runnable()
{
@Override
public void run()
{
chat.setText(msg);
}
});
}
in.close();
答案 0 :(得分:1)
要按行读取,请尝试BufferedReader:
BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));