apk - How to Access sysfs entry from android application -
can please explain me on how access value exposed sysfs android application.
a reference suggests can not access here
but there 1 android application same.
please explain.
i found answer after research
this how works.
//cmd path of script executed string cmd = "/home_dir/./my_shell_script.sh" ; runtime run = runtime.getruntime() ; //this run script java process pr = run.exec(cmd) ;
the values returned can read this
bufferedreader buf = new bufferedreader(new inputstreamreader(pr.getinputstream())); try { string string = buf.readline(); char[] text = string.tochararray(); int start = 0; int len = string.length(); textview.settext(text, start, len); toast.maketext(this, string, toast.length_short).show(); } catch (ioexception e) { toast.maketext(this, e.getmessage(), toast.length_short).show(); }
it show variable/output in toast message.
references:
1 executing shell command java
2 /sys/devices/virtual/gpio access java?
please let me know if there other methods this.
Comments
Post a Comment