如題,編輯器顯示DeadCode請大大幫我找一下哪裡有錯誤,謝謝!!
-------------顯示DeadCode部分-------------
if (R.id.userinput_height > 10 & R.id.userinput_height < 300 & R.id.userinput_weight > 1 & R.id.userinput_weight < 800) {
try {
double height = Double.parseDouble(info_height.getText().toString())/100;
double weight = Double.parseDouble(info_weight.getText().toString());
double BMI = weight / (height * height);
TextView result = (TextView)findViewById(R.id.result);
result.setText(getText(R.string.yourBMI) + nf.format(BMI));
TextView suggest = (TextView)findViewById(R.id.suggest);
if (BMI > 25) {
suggest.setText(R.string.advice_heavy);
} else if (BMI < 20) {
suggest.setText(R.string.advice_light);
} else {
suggest.setText(R.string.advice_normal);
}
} catch (Exception obj) {
Toast.makeText (MainActivity.this, R.string.input_error, Toast.LENGTH_SHORT) .show();
}
} else {
Toast.makeText (MainActivity.this, R.string.input_error, Toast.LENGTH_SHORT) .show();
}
----結束-------
排版不太好看請見諒
This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers. Five Filters recommends: 'You Say What You Like, Because They Like What You Say' - http://www.medialens.org/index.php/alerts/alert-archive/alerts-2013/731-you-say-what-you-like-because-they-like-what-you-say.html
留言列表