android UI react weird in gyroscope event -
i have app used gyroscope control value of padding. doesn't update ui unless i'm touching or moving device screen.
private void gyrofunction(sensorevent event) { sensormanager .getrotationmatrixfromvector(mrotationmatrix, event.values); sensormanager.remapcoordinatesystem(mrotationmatrix, sensormanager.axis_x, sensormanager.axis_z, mrotationmatrix); sensormanager.getorientation(mrotationmatrix, orientationvals); // must put line of code make ui thread update every time temptxtview.settext(string.valueof(orientationvals[2])); imgv.setpadding((int) math.round(orientationvals[0]), (int) math.round(orientationvals[1]), (int) math.round(orientationvals[0]), (int) math.round(orientationvals[1])); }
however when added temporary textview update value according gyro event, works. don't think it's solution block screen. there other solution?
does calling imgv.invalidate() after setting padding work?
Comments
Post a Comment