title: How do I access an object property/key in Java (Android) by string variable
body: <p><strong>EDIT:</strong> To clarify, I want to get the <strong>value</strong> of the property, not the name of the property. I know the name of the property but I need to access the property via a string containing the property name. I am importing an API, that has additional vendor properties (not part of the standard documentation or SDK) which I am trying to access the value of.</p>
  <p>Hi I have the following code</p>
  <pre><code>                String mykey = &quot;SCALER_AVAILABLE_STREAM_CONFIGURATIONS&quot;;
                   mystring.append(characteristics[mykey]);
  </code></pre>
  <p>characteristics is a type of object CameraCharacteristics, and SCALER_AVAILABLE_STREAM_CONFIGURATIONS is a property of it. How do I access a property of an object by a variable in Java (using Android Stuidio)?</p>
  <p>Log:</p>
  <pre><code>incompatible types: String cannot be converted to int
                           mystring.append(characteristics[mykey]);
  </code></pre>
  <p>The tooltip info gives me <code>Array type expected; found: 'android.hardware.camera2.CameraCharacteristics'</code></p>