java - setOnClickListener crashes my wear app -


I have created an app for my Android phone to control a robot-car through Raspberry P Works, but now I'm trying to shut down the app in the Android Ware app. However, when I try to run an app on my Wear device, it crashes on startup error log, it comes from SetOnClickListeners. How should I fix these errors? thank you in advanced!

EDIT: Errors given by the logk runtime exception and a NullPointerException @Override Secure Zero (Bundle Saved InstantState) {super.onCreate (SavedInstanceState); SetContentView (R.layout.activity_main); Button connect = (button) Find VVBID (R. Button Connect); ButtonConnect.setOnClickListener (this); Button disconnected = (button) Find VibibIID (RID Button DISConnect); ButtonDisconnect.setOnTouchListener (this); Find button = (button) VVBIID (RID button reverse); ButtonReverse.setOnTouchListener (this); Button lift = (button) Find VVBID (R. Button Lift); ButtonLeft.setOnTouchListener (this); ButtonForward = (View) ViewById (R.id.buttonForward); ButtonForward.setOnTouchListener (this); Button = Search = (button) VibibIID (R.B.Button Road); ButtonRight.setOnTouchListener (this); }

Definitely not helpful:

  @SuppressLint ("clickable view feature") @ Override public boolean on-touch (see V , Motion Event Event) {if ((R.id.buttonForward == v.getId ())} {switch (event.getAction ()) {Case MotionEvent.ACTION_DOWN: Socket Commands ("Forward"); break; Case Motion Event Action_up: Socket Command ("Stop"); break; }} And if ((RID.button reverse == v.getId ()) {switch (event.getAction ()) {Case Motion Aven. Action_DOWN: Socket Commands ("Back"); break; Case Motion Event Action_up: Socket Command ("Stop"); break; }} And if ((RID. Button Wright == v.getId ()) {Switch (event.getAction ()) {Case Motion Event. Action_down: socket command ("true"); break; Case Motion Event Action_up: Socket Command ("Stop"); break; }} And if ((Rid.button lift == v.getId ())} {switch (event.getAction ()) {Case MotionEvent.ACTION_DOWN: Socket Commands ("left"); break; Case Motion Event Action_up: Socket Command ("Stop"); break; }     }      return false; } @ Override Public Wide Onclick OnClick (see V) {Switch (v.getId ()} {Case R.D. Button Connect: {System.out.println ("ONCLICK CONNECT"); SocketConnect.connect (); break; } Case R.id.buttonDisconnect: {SocketConnect.closeConnection (); break; Thanks in advance!   

You are probably working with your Android device's DPI requirements to work with your Creating a version of one of the existing layouts, no?

I'm sure you have one or more of these these IDs containing these IDs: your activity_main.xml file:

  buttonConnector buttonDisconnect buttonSearch buttonbar button tool button right  

The result will be the NullPointer exception.


Comments