Only post message if connection to child was lost

If the connection to the child was intentionally severed, do not
post a "disconnected" message, as the activity is likely closing.
This commit is contained in:
Branden Archer
2015-12-28 17:11:58 -05:00
parent 6dd26b70fe
commit 0d829708c7

View File

@@ -139,18 +139,22 @@ public class ListenActivity extends Activity
Log.e(TAG, "Failed to stream audio", e); Log.e(TAG, "Failed to stream audio", e);
} }
ListenActivity.this.runOnUiThread(new Runnable() if(Thread.currentThread().isInterrupted() == false)
{ {
@Override
public void run()
{
final TextView connectedText = (TextView) findViewById(R.id.connectedTo);
connectedText.setText("");
final TextView statusText = (TextView) findViewById(R.id.textStatus); ListenActivity.this.runOnUiThread(new Runnable()
statusText.setText(R.string.disconnected); {
} @Override
}); public void run()
{
final TextView connectedText = (TextView) findViewById(R.id.connectedTo);
connectedText.setText("");
final TextView statusText = (TextView) findViewById(R.id.textStatus);
statusText.setText(R.string.disconnected);
}
});
}
} }
}); });