Skip to content

Commit

Permalink
Avoid crash
Browse files Browse the repository at this point in the history
  • Loading branch information
pluscubed committed Apr 23, 2016
1 parent 57d4736 commit 8faa8c1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/src/main/java/com/pluscubed/velociraptor/FloatingService.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ public int onStartCommand(Intent intent, int flags, int startId) {
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
PixelFormat.TRANSLUCENT);
debuggingParams.gravity = Gravity.BOTTOM;
mWindowManager.addView(mDebuggingText, debuggingParams);
try {
mWindowManager.addView(mDebuggingText, debuggingParams);
} catch (Exception e) {
showToast("Velociraptor error: " + e.getMessage());
}

updatePrefSpeedometer();
updatePrefDebugging();
Expand Down Expand Up @@ -242,7 +246,11 @@ private void inflateMonitor() {
PixelFormat.TRANSLUCENT);
params.gravity = Gravity.TOP | Gravity.START;
if (mWindowManager != null)
mWindowManager.addView(mFloatingView, params);
try {
mWindowManager.addView(mFloatingView, params);
} catch (Exception e) {
showToast("Velociraptor error: " + e);
}
mFloatingView.setOnTouchListener(new FloatingOnTouchListener());

initMonitorPosition();
Expand Down

0 comments on commit 8faa8c1

Please sign in to comment.