原因:getStringExtra()为空导致
解决:用以下判断接收
Bundle bundle = intent.getExtras(); if (bundle != null) { String data = bundle.getString(BluetoothLeService.EXTRA_DATA); if (data != null) { } }
Bundle bundle = intent.getExtras();if (bundle != null) { String data = bundle.getString(BluetoothLeService.EXTRA_DATA); Log.e("mainData1",data); //显示到界面if (data != null) { Log.e("mainData2",data); //初始化圆形进度条initArcProgressBar(100,Integer.parseInt(data),"优"); }}
时间: 2024-11-02 23:40:42