Code example for Field

Methods: setAccessiblegetType

0
		Class<ColorDrawable> cdClass = ColorDrawable.class;
 
		try { 
			cdBackgroundStateField = cdClass
					.getDeclaredField(COLOR_DRAWABLE_STATE_VAR);
			cdBackgroundStateField.setAccessible(true);
		} catch (Exception e) {
			Log.e(TAG,
					"Reflection failed while trying to determine background color of view.", 
					e);
			cdBackgroundStateField = null;
			return; 
		} 
 
		try { 
			cdBackgroundStateColorField = cdBackgroundStateField.getType()
					.getDeclaredField(COLOR_DRAWABLE_USE_COLOR_VAR);
			cdBackgroundStateColorField.setAccessible(true);
		} catch (Exception e) {
			Log.e(TAG,
					"Reflection failed while trying to determine background color of view.", 
Experience pair programming with AI  Get Codota for Java