Post error message from Listening Thread
This commit is contained in:
@@ -52,10 +52,7 @@ public class ListenActivity extends Activity {
|
||||
final VolumeView volumeView = findViewById(R.id.volume);
|
||||
volumeView.setVolumeHistory(bs.getVolumeHistory());
|
||||
bs.setUpdateCallback(volumeView::postInvalidate);
|
||||
bs.setErrorCallback(() -> {
|
||||
TextView status = findViewById(R.id.textStatus);
|
||||
status.setText(R.string.disconnected);
|
||||
});
|
||||
bs.setErrorCallback(ListenActivity.this::postErrorMessage);
|
||||
}
|
||||
|
||||
public void onServiceDisconnected(ComponentName className) {
|
||||
@@ -103,6 +100,13 @@ public class ListenActivity extends Activity {
|
||||
context.stopService(intent);
|
||||
}
|
||||
|
||||
public void postErrorMessage() {
|
||||
TextView status = findViewById(R.id.textStatus);
|
||||
status.post(() -> {
|
||||
status.setText(R.string.disconnected);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Reference in New Issue
Block a user