我在運行時得到FC但編譯。如果然後使用微調器顯示的值
注意:已經對Rasel的評論進行了更改。不過FC的
btnExecute.setOnClickListener(new View.OnClickListener() //this worked
{
private AlertDialog show;
public void onClick(View arg0)
{ //start of get stack shape and provide area and equivalent diameter
//20110720
//just trying to evaluate the shape to use the correct inputs for area calculation
//I will then add and evaluate for the units of input to build universal
//values(_eng and _met)variables to use for all further calculations. KISS!
if (((m1_ss_spinner.getSelectedItem().toString().equals("Square")))) //cant compare a string with == operator. Use equals() to compare
{
if ((m1_sqs1.getText().length() == 0) //if m1_sqs1 is empty
|| (m1_sqs1.getText().toString().equals(""))) //if m1_sqs1 is blank
{
show = new AlertDialog.Builder(mContext).setTitle("Error") //this worked
.setMessage("The Square Side length is empty")
.setPositiveButton("OK", null).show();
} else
{
double result = new Double(m1_sqs1.getText().toString()) * new Double(m1_sqs1.getText().toString());
m1_sa_in.setText(Double.toString(result));
} //end of square area
} else
if (((m1_ss_spinner.getSelectedItem().toString().equals("Rectangle"))))
{
if ((m1_rs1.getText().length() == 0)
|| (m1_rs1.getText().toString().equals("")
|| (m1_rs2.getText().length() == 0)
|| (m1_rs2.getText().toString().equals(""))))
{
show = new AlertDialog.Builder(mContext).setTitle("Error")
.setMessage("A Rectangle Side length is empty")
.setPositiveButton("OK", null).show();
} else
{
double result = new Double(m1_rs1.getText().toString()) * new Double(m1_rs2.getText().toString());
m1_sa_in.setText(Double.toString(result));
} //end of rectangle area
} else
if (((m1_ss_spinner.getSelectedItem().toString().equals("Circle"))))
{
if ((m1_cd.getText().length() == 0)
|| (m1_cd.getText().toString().equals("")))
{
show = new AlertDialog.Builder(mContext).setTitle("Error")
.setMessage("The Circle Diameter is empty")
.setPositiveButton("OK", null).show();
} else
{
double result = new Double(m1_cd.getText().toString()) * new Double(m1_cd.getText().toString());
m1_sa_in.setText(Double.toString(result));
} //end of circle area
} else
if (((m1_ss_spinner.getSelectedItem().toString().equals("Elliptical"))))
{
if ((m1_els1.getText().length() == 0)
|| (m1_els1.getText().toString().equals("")
|| (m1_els2.getText().length() == 0)
|| (m1_els2.getText().toString().equals(""))))
{
show = new AlertDialog.Builder(mContext).setTitle("Error")
.setMessage("An Elliptical Diameter is empty")
.setPositiveButton("OK", null).show();
} else
{
double result = new Double(m1_els1.getText().toString()) * new Double(m1_els2.getText().toString());
m1_sa_in.setText(Double.toString(result));
}; //end of elliptical area
} // end of onClick code
}
});
你能正確地格式化你的問題,其難以閱讀...... – Marty
你可以把你的logcat錯誤 – Rasel
顯示com.androidbook.triviaquiz8/.QuizHelpActivity:+ 656ms 關閉虛擬機 threadid = 1:線程退出與未捕獲的異常(組= 0x40015560) 發送信號。 PID:22123 SIG:9 – WmBurkert