[Android] Check accessability before dynamically setting resource ids

When not used as Android Library, the resource ids in R.java will
be final. To avoid a lot of warning messages in such case, check
accessability before trying to set values.