Answer the question
In order to leave comments, you need to log in
New message to new textView?
textViewMessage = new TextView(this);
private class SetScrollViewMessage implements Runnable {
@Override
public void run() {
try {
InputStream inputStream = socket.getInputStream();
DataInputStream dataInputStream = new DataInputStream(inputStream);
if(dataInputStream != null){
final String stringMessage = dataInputStream.readUTF();
runOnUiThread(new Runnable() {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void run() {
while (true){
textViewMessage.setText(stringMessage);
textViewMessage.setBackgroundResource(R.color.colorPrimaryDark);
textViewMessage.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
linearLayoutMessage.addView(textViewMessage);
}
}
});
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question