I'm facing a problem,On a button press i try to read the DataInputstream which has data coming in and display the data.
I'm using a while loop to read the data. But the dynamic update of the Textview doesnt happen.
TextView datatextview = (TextView)findViewById(R.id.data); 
DataInputStream Din = new DataInputStream(socket.getInputStream());
Button getData= (Button)findViewById(R.id.getdata);
getData.setOnClickListener(new OnClickListener() {
    public void onClick(View v) { 
    //.......stuff .......
    try{
    int bufferSize = 1024;
    byte[] buffer = new byte[bufferSize];
    int bytesRead = -1;
    String message1 = "";
    while (true) {
        message1 = "";
        data = Din.readLine();
        bytesRead = (reading).length();
        if (bytesRead != -1) {
            Log.v(TAG,"data"+data); //I'm getting the data correctly
            //But not able to update it in the TextView :(
            datatextview.setText(data);  //doesnt work
        }
    }