java - Path requests must specify a user by using UserEnvironment -


i getting "path requests must specify user using userenvironment" error using

environment.getexternalstoragedirectory().getpath() 

i traced code , found in java.io.environment there function produce error :

 private static void throwifuserrequired() {      if (suserrequired) {          log.wtf(tag, "path requests must specify user using userenvironment",                  new throwable());      }  } 

i searched in web , found solution here

environment.setuserrequired(false); 

but solution not working me because cannot access "setuserrequired" method of environment. compilation error. searched function in environment class , found :

/** {@hide} */ public static void setuserrequired(boolean userrequired) {     suserrequired = userrequired; } 

can me how can access external storage of phone? solution ? emergency. lot

you need use userenvironment , path user.

int userid = userhandle.myuserid(); scurrentuser = new userenvironment(userid); 

this code stolen environment.java , code use initialize internal user.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -