import android.widget.Toast;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
public void bEqual(View v) throws ScriptException {
ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine engine = mgr.getEngineByName("JavaScript");
String value = inputText.getText().toString();
Toast.makeText(this,value,Toast.LENGTH_LONG).show();
try{
result = (double)engine.eval(value);
Toast.makeText(this,String.format("%f",result),Toast.LENGTH_SHORT).show();
}catch(Exception e){
Toast.makeText(this,"Exception Raised",Toast.LENGTH_SHORT).show();
}
}
What is wrong in it? App is exiting when perform this action. It is not showing any errors but app is closing