@@ -39,13 +39,10 @@ public void onPause() {
3939 // sure to unbind from the service to avoid leaking memory
4040 if (mVehicleManager != null ) {
4141 Log .i (TAG , "Unbinding from Vehicle Manager" );
42- try {
43- // Remember to remove your listeners, in typical Android
44- // fashion.
45- mVehicleManager .removeListener (EngineSpeed .class , mSpeedListener );
46- } catch (VehicleServiceException e ) {
47- e .printStackTrace ();
48- }
42+ // Remember to remove your listeners, in typical Android
43+ // fashion.
44+ mVehicleManager .removeListener (EngineSpeed .class ,
45+ mSpeedListener );
4946 unbindService (mConnection );
5047 mVehicleManager = null ;
5148 }
@@ -89,8 +86,10 @@ public void run() {
8986 };
9087
9188 private ServiceConnection mConnection = new ServiceConnection () {
92- // Called when the connection with the VehicleManager service is established, i.e. bound.
93- public void onServiceConnected (ComponentName className , IBinder service ) {
89+ // Called when the connection with the VehicleManager service is
90+ // established, i.e. bound.
91+ public void onServiceConnected (ComponentName className ,
92+ IBinder service ) {
9493 Log .i (TAG , "Bound to VehicleManager" );
9594 // When the VehicleManager starts up, we store a reference to it
9695 // here in "mVehicleManager" so we can call functions on it
@@ -102,13 +101,7 @@ public void onServiceConnected(ComponentName className, IBinder service) {
102101 // have an EngineSpeed.Listener (see above, mSpeedListener) and here
103102 // we request that the VehicleManager call its receive() method
104103 // whenever the EngineSpeed changes
105- try {
106- mVehicleManager .addListener (EngineSpeed .class , mSpeedListener );
107- } catch (VehicleServiceException e ) {
108- e .printStackTrace ();
109- } catch (UnrecognizedMeasurementTypeException e ) {
110- e .printStackTrace ();
111- }
104+ mVehicleManager .addListener (EngineSpeed .class , mSpeedListener );
112105 }
113106
114107 // Called when the connection with the service disconnects unexpectedly
0 commit comments