I got issue with Nexus 10 - 4.2.2. I was testing code below on Galaxy Tab 10.1 with 4.0.4 and it was working fine:
try
{
Process proc = Runtime.getRuntime()
Answer by goodm works fine, but most of us are not aware about envp
So here is full code:
HIDE
try
{
String command;
command = "LD_LIBRARY_PATH=/vendor/lib:/system/lib service call activity 42 s16 com.android.systemui";
ArrayList envlist = new ArrayList();
Map env = System.getenv();
for (String envName : env.keySet()) {
envlist.add(envName + "=" + env.get(envName));
}
String[] envp = (String[]) envlist.toArray(new String[0]);
Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", command }, envp);
proc.waitFor();
}
catch(Exception ex)
{
Toast.makeText(getApplicationContext(), ex.getMessage(), Toast.LENGTH_LONG).show();
}
You can use similar for show.