Я пытаюсь отправить данные с устройства Android на встроенное устройство через устройство чтения QR-кодов, но приложение вылетает.Как решить эту проблему?
мой файл java: Основная активность. Java
Мой файл XML: Activity_main.xml
Как исправить проблему в моем устройстве?
2019-02-23 00:19:32.571 4544-4544/com.example.bluetooth_embaded E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.bluetooth_embaded, PID: 4544
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.bluetooth_embaded/com.example.bluetooth_embaded.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2895)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1616)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:6651)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
at com.example.bluetooth_embaded.MainActivity.onCreate(MainActivity.java:79)
at android.app.Activity.performCreate(Activity.java:7088)
at android.app.Activity.performCreate(Activity.java:7079)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2895)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1616)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:6651)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
2019-02-23 00:19:32.598 4544-4544/com.example.bluetooth_embaded I/Process: Sending signal. PID: 4544 SIG: 9