相机的未知消息类型是什么?

时间:2019-05-09 02:52:58

标签: android android-camera

我正在测试QR码阅读器应用程序。

我正在使用zxing library

并且Camera:unknown message type错误不断发生。

我得到的数字是两个-1073741824131072

它们不会影响应用程序,例如暗恋或致命错误。但是,我想知道是否可以忽略它们,或者是否有一种方法可以纠正它,或者是否有更好的方法使用zxing库来实现它。

这里是MainActivity.kt

package com.example.qrtest

import android.Manifest
import android.os.Bundle
import android.view.WindowManager
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.google.zxing.Result
import com.gun0912.tedpermission.PermissionListener
import com.gun0912.tedpermission.TedPermission
import kotlinx.android.synthetic.main.activity_main.*
import me.dm7.barcodescanner.zxing.ZXingScannerView
import timber.log.Timber

class MainActivity : AppCompatActivity(), ZXingScannerView.ResultHandler {

    init {
        if (BuildConfig.DEBUG) {
            Timber.plant(Timber.DebugTree())
            Timber.d("start")
        }
    }

    override fun handleResult(result: Result?) {
        val scanResult = result?.text
        Toast.makeText(this@MainActivity, scanResult, Toast.LENGTH_SHORT).show()
        Timber.d("scan result: $scanResult")
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)

        setContentView(R.layout.activity_main)

        val permissionlistener = object : PermissionListener {
            override fun onPermissionGranted() {
                Toast.makeText(this@MainActivity, "Permission Granted", Toast.LENGTH_SHORT).show()

                sv_preview.setResultHandler(this@MainActivity)
                sv_preview.startCamera()

                iv_mlb_logo.setOnClickListener {
                    when (sv_preview.flash) {
                        true -> sv_preview.flash = false
                        false -> sv_preview.flash = true
                    }
                }
            }

            override fun onPermissionDenied(deniedPermissions: List<String>) {
                Toast.makeText(this@MainActivity, "Permission Denied\n$deniedPermissions", Toast.LENGTH_SHORT).show()
            }
        }

        TedPermission.with(this@MainActivity)
            .setPermissionListener(permissionlistener)
            .setDeniedMessage("If you reject permission,you can not use this service\n\nPlease turn on permissions at [Setting] > [Permission]")
            .setPermissions(Manifest.permission.CAMERA)
            .check()
    }

    override fun onResume() {
        super.onResume()

        sv_preview.setResultHandler(this@MainActivity)
        sv_preview.startCamera()
    }

    companion object {
        val MLB_QR_CODE = 0x0000ffff
    }
}

这是错误消息:

2019-05-09 11:48:12.557 20404-20456/com.example.qrtest E/Camera: Unknown message type 1073741824
2019-05-09 11:48:12.564 20404-20456/com.example.qrtest E/Camera: Unknown message type 131072
2019-05-09 11:48:12.723 20404-20456/com.example.qrtest E/Camera: Unknown message type 131072
2019-05-09 11:48:12.889 20404-20456/com.example.qrtest E/Camera: Unknown message type 131072
2019-05-09 11:48:13.065 20404-20456/com.example.qrtest E/Camera: Unknown message type 131072
2019-05-09 11:48:13.225 20404-20456/com.example.qrtest E/Camera: Unknown message type 131072
2019-05-09 11:48:13.393 20404-20456/com.example.qrtest E/Camera: Unknown message type 131072
2019-05-09 11:48:13.557 20404-20456/com.example.qrtest E/Camera: Unknown message type 131072
2019-05-09 11:48:13.723 20404-20456/com.example.qrtest E/Camera: Unknown message type 131072

以上消息永不停止。他们在重复。

0 个答案:

没有答案