2

I'm creating camera app and I want to log infos about camera state. Now I'm using:

Log.i("AF state", String.valueOf(result.get(CaptureResult.CONTROL_AF_STATE)));

It returns values like:

I/AF state: 1

It is hard to read and I'm curious if there is a way to log field names that these numbers represent, for example:

I/AF state: CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED
  • would you please add more code explaining the context? what does the `result.get` method do? can you share the definition of the `CaptureResult` enum? – saniales Apr 10 '20 at 15:56
  • this question is already asked here https://stackoverflow.com/questions/14944333/get-name-of-a-field – Chamlal Apr 10 '20 at 15:58
  • 1
    result is CaptureResult type from CameraCaptureSession.CaptureCallback – user13278676 Apr 12 '20 at 14:12

1 Answers1

0

You can use getName()

Log.i("AF state", result.get(CaptureResult.CONTROL_AF_STATE).getName());

from Android Developer Docs

Return a camelCase, period separated name formatted like:

"root.section[.subsections].name".
saniales
  • 451
  • 3
  • 14