Когда я запускаю свой код на своем телефоне, APK устанавливается и открывается, но когда я набираю два параметра, единственная возвращаемая опция - это заключительное выражение if. Даже если оно ложно и другие операторы верны, оно все равно выполняется.
Это файл MainActivity.java.
float crazy;
float hotness;
static final String NOGOZONE = "ExampleText";
static final String DANGERZONE = "ExampleText";
static final String FUNZONE = "ExampleText" ;
static final String UNICORN = "ExampleText" ;
static final String TRANNY = "ExampleText" ;
static final String LESSTHAN4 = "ExampleText" ;
static final String WIFEZONE = "ExampleText" ;
static final String DATEZONE = "ExampleText" ;
public void main(View view)
{
String herZone = test(hotness, crazy);
((TextView)findViewById(R.id.output)).setText(herZone);
}
static String test(float hotness, float crazy)
{
String herZone = DANGERZONE;
if ( hotness < 5 )
{
herZone = NOGOZONE;
}
if ( hotness >= 5 && crazy <= 5 )
{
herZone = FUNZONE;
}
if ( hotness >= 5 && hotness < 7 && crazy > 5 && crazy <= 7)
{
herZone = DANGERZONE;
}
if ( hotness > 7 && crazy > 8 )
{
herZone = DANGERZONE;
}
if ( hotness >= 7 && hotness < 8 && crazy > 5 && crazy <= 8)
{
herZone = FUNZONE;
}
if ( hotness < 7 && crazy > 7 )
{
herZone = DANGERZONE;
}
if ( hotness >= 8 && crazy >= 7 )
{
herZone = DATEZONE;
}
if ( hotness >= 8 && crazy <= 7 )
{
herZone = WIFEZONE;
}
if ( hotness >= 8 && crazy <= 5 )
{
herZone = UNICORN;
}
if ( hotness >= 8 && crazy <= 4 )
{
herZone = TRANNY;
}
if ( crazy < 4 )
{
herZone = LESSTHAN4;
}
return herZone;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
Этот код кнопки xml onClick равен android:onClick="main"
. Кто-нибудь знает, как это исправить? Я делаю глупую ошибку? заранее спасибо :) <3 </strong>