Wednesday, 15 January 2014

android - unable to access the SENSOR_SERVICE inside fragment -



android - unable to access the SENSOR_SERVICE inside fragment -

this used

ssensormanager = (sensormanager)this.getsystemservice(sensor_service);

in activity , in fragment making below

ssensormanager = (sensormanager)rootview.getcontext().getsystemservice(sensor_service);

and there redline below sensor_service below

sensor_service cannot resolved variable

try in fragment

ssensormanager = (sensormanager)getactivity().getsystemservice(getactivity().sensor_service);

android fragment

No comments:

Post a Comment