I have one method that returns a BufferedReader
from which my App is getting the output of another program.
In Manager.java
public BufferedReader start() {
String[] commandLine2 = { "/system/bin/sh", "/system/app/launcher.sh" };
Process process = null;
try {
process = Runtime.getRuntime().exec(commandLine2);
reader = new BufferedReader(new InputStreamReader(
process.getInputStream()));
writer = new OutputStreamWriter(process.getOutputStream());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return reader;
}
In my MainActivity I use:
outputReader = manager.start();
where outputReader is a private instance of BufferedReader
and manager is one of Manager.
As long as I use this Buffered reader in an AsyncTask inside MainActivity.java everything goes ok since my BufferedReader
is visible in its scope but when I want to use a Service to accomplish the task I have some troubles.
There is no way to use a Intent.putExtra(Object)
with objects which are neither Serializable nor Parcelable (and my BufferedReader is not).
How can I pass my BufferedReader
to a Service then?