I have a problem with my Android Program. I'm using mxparser as my Math Parser. I added it to my Lib. No errors are showing after I typed my program using this but the program gets an error when i click a certain button when running. I tried debugging it many times and I'm sure the error comes from the parser. Any Ideas?
private OnClickListener ButtonClicked= new OnClickListener()
{
@Override
public void onClick(View v)
{
Function f = new Function("f(x) = "+funcText.getText().toString());
Expression xlexp = new Expression("f("+xlText.getText().toString()+")",f);
Expression xuexp = new Expression("f("+xuText.getText().toString()+")",f);
double c = xlexp.calculate();
double d = xuexp.calculate();
String xlString = String.valueOf(c);
String xuString = String.valueOf(d);
fxlText.setText(xlString);
fxuText.setText(xuString);
}
};
Update:
This is the Error Message (I think xD)
Thank you LutzL for keeping up with me :D
Update2:
I edited the code:
private OnClickListener ButtonClicked= new OnClickListener()
{
@Override
public void onClick(View v)
{
xlText.getText();
xuText.getText();
String firstString=xlText.getText().toString();
String secondString=xuText.getText().toString();
double xl = Double.parseDouble(firstString);
double xu = Double.parseDouble(secondString);
double f=2*xl+1;
double f2=2*xu+1;
String xlstring = String.valueOf(f);
String xustring = String.valueOf(f2);
fxlText.setText(xlstring);
fxuText.setText(xustring);
}
};
This is working. In this code, I get the values of xl and xu then I inserted it in the function I made(2*x+1). But what I need is a code that also gets the function from the user. That's why I used mxparser.
Update3:
I started debugging it and this shows(Source not Found). Don't know what it means. any idea? :(