Skip to content

Commit 2e36c54

Browse files
author
Kunal
committed
toast in gas sensor corrected
1 parent 92f56a5 commit 2e36c54

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/src/main/java/io/pslab/fragment/GasSensorDataFragment.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
8383
super.onCreate(savedInstanceState);
8484
startTime = System.currentTimeMillis();
8585
gasSensorActivity = (GasSensorActivity) getActivity();
86+
8687
}
8788

8889
@Nullable
@@ -91,6 +92,9 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
9192
rootView = inflater.inflate(R.layout.fragment_gas_sensor, container, false);
9293
unbinder = ButterKnife.bind(this, rootView);
9394
scienceLab = ScienceLabCommon.scienceLab;
95+
if (!scienceLab.isConnected()){
96+
Toast.makeText(getContext(), R.string.not_connected, Toast.LENGTH_SHORT).show();
97+
}
9498
entries = new ArrayList<>();
9599
setupInstruments();
96100
return rootView;
@@ -366,9 +370,7 @@ private void visualizeData() {
366370
mChart.moveViewToX(data.getEntryCount());
367371
mChart.invalidate();
368372
}
369-
} else {
370-
Toast.makeText(getContext(), R.string.not_connected, Toast.LENGTH_SHORT).show();
371-
}
373+
}
372374
}
373375

374376
private void setupInstruments() {

0 commit comments

Comments
 (0)