FOROS PROFESIONALES
WINDEV
,
WEBDEV
y
WINDEV Mobile
Inicio
|
Mensajes recientes
|
Conéctese...
|
Desconectar
|
Español
Inicio
→
WINDEV Mobile 2024
→
Intent JAVA vers application Terminal Emulator
Intent JAVA vers application Terminal Emulator
Iniciado por soita, 21,jun. 2017 13:05 - 2 respuestas
Conéctese…
soita
#1
Publicado el 21,junio 2017 - 13:05
Bonjour à tous,
Je souhaite pouvoir exécuter une ligne de commande shell directement via un Intent comme le propose le créateur de l'application sur son wiki :
https://github.com/jackpal/Android-Terminal-Emulator/wiki/Launching-Terminal-Emulator-for-Android-from-another-App
Voici ce que je souhaite utiliser selon son exemple :
// opens a new window and runs "echo 'Hi there!'"
// application must declare jackpal.androidterm.permission.RUN_SCRIPT in manifest
Intent i = new Intent("jackpal.androidterm.RUN_SCRIPT");
i.addCategory(Intent.CATEGORY_DEFAULT);
i.putExtra("jackpal.androidterm.iInitialCommand", "echo 'Hi there!'");
startActivity(i);
Gradle me retourne une erreur de type Symbol en me montrant une flèche sous le s de stratActivity(i) ??????????
Pourriez-vous m'éclairer s'il vous plait ?
Informar
0
0
JeAn-PhI
#2
Publicado el 21,junio 2017 - 14:38
soita a utilisé son clavier pour écrire :
Bonjour à tous,
Je souhaite pouvoir exécuter une ligne de commande shell directement via un
Intent comme le propose le créateur de l'application sur son wiki :
https://github.com/jackpal/Android-Terminal-Emulator/wiki/Launching-Terminal-Emulator-for-Android-from-another-App
Voici ce que je souhaite utiliser selon son exemple :
// opens a new window and runs "echo 'Hi there!'"
// application must declare jackpal.androidterm.permission.RUN_SCRIPT in
manifest
Intent
i
=
new
Intent
(
"jackpal.androidterm.RUN_SCRIPT"
)
;
i.addCategory
(
Intent.CATEGORY_DEFAULT
)
;
i.putExtra
(
"jackpal.androidterm.iInitialCommand"
,
"echo 'Hi there!'"
)
;
startActivity
(
i
)
;
Gradle me retourne une erreur de type Symbol en me montrant une flèche sous
le s de stratActivity(i) ??????????
Pourriez-vous m'éclairer s'il vous plait ?
essayez en ajoutant ceci :
Activity act = getActiviteEnCours();
act.startActivity(i);
--
Cordialement JeAn-PhI
Informar
0
0
Philippe Pasquali
#3
Miembro registrado
946 mensajes
Popularité : +102 (110 votes)
Publicado el 21,junio 2017 - 21:02
Bonjour
Cette petite fonction java à mettre en procédure globale de type java devrait répondre à votre besoin
// Exécute une commande avec le shell
// Exemples :
// ShellExecute("service list")
// ShellExecute("service check phone")
// ShellExecute("ls /system")
// ShellExecute("date")
// ShellExecute("ps")
// ShellExecute("logcat -g")
// ShellExecute("logcat -d")
import java.lang.Runtime;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public static String ShellExecute(String pCommand)
{
StringBuffer output = new StringBuffer();
String response = "";
String line = "";
Process p;
try {
p = Runtime.getRuntime().exec(pCommand);
p.waitFor();
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ((line = reader.readLine())!= null) {
response += line + "\r\n";
}
} catch (Exception e) {
e.printStackTrace();
}
return response;
}
Informar
1
0
→ Volver a WINDEV Mobile 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (versiones precedentes)
WEBDEV (versiones precedentes)
WINDEV Mobile (versiones precedentes)
Reports & Queries
Irrelevante
Herramientas
Français
English
Español
Portuguesa
Fermer cette fenêtre
Búsqueda Tipo
Sólo temas
Todos los mensajes
Periodo Buscar
Cualquier fecha
Última hora
Última 24 horas
Última semana
Último mes
Último año
Cancelar
Vista previa del mensaje
Añadiendo una imagen
Importar una imagen desde una URL
Enviar una imagen desde un archivo de su disco
Arrastrar un archivo o click en "Examinar..."
o
Cancelar
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Texto