Ho creato una semplice ide beanshell in Android usando un edittext e un pulsante. Quando si fa clic sul pulsante, viene chiamato Interpreter.eval()
e viene passato edittext.getText().toString()
come parametro. Voglio sapere: come posso creare un metodo in beanshell ed eseguirlo?come creare metodi in beanshell?
Questo è il codice im cercando di eseguire nel mio BeanShell ide:
import android.widget.Toast
int i=add(1, 5);
Toast.makeText(context, ""+i, 5000).show();
int add(int i, int j){
return i+j;
}
ma ottengo il seguente errore:
Command not found: add()
sì, quello ha funzionato. Grazie mille.. – Shantanu