Я просто пытаюсь запустить свое приложение, и каждый раз, когда я запускаю его, оно выдает мне это сообщение и останавливает запуск приложений.AVD остается открытым, и я вижу типичный домашний экран Android, но мое приложение просто не запускается.Сборка Gradle завершается и собирается правильно, но мое приложение по-прежнему не открывается.
открытый класс MainActivity расширяет AppCompatActivity {
String [] states = {"Alabama","Alaska","Arizona","Arkansas", "the rest of the US states"};
String storage = "";
Double stormCount = 0.0;
int yearChoice;
double xval = yearChoice - 1950;
Spinner stateSpinner;
EditText yearInput;
TextView networkResults;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
stateSpinner = findViewById(R.id.stateSpinner);
ArrayAdapter <String> adapter;
yearInput = findViewById(R.id.yearInput);
networkResults = findViewById(R.id.networkResults);
adapter = new ArrayAdapter<>(this,android.R.layout.simple_list_item_1,states);
stateSpinner.setAdapter(adapter);
yearChoice = Integer.valueOf(yearInput.getText().toString());
stateSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long l) {
if(position == 0) {
stormCount = 14.5160471387124 * Math.pow(Math.E, .0742980947989195 * xval);
storage = "The amount of storms in "+states[position]+" in "+yearChoice+" is "+Math.floor(stormCount)+". This reading is about 70% accurate.";
}
if(position == 1) {
storage = ("Sorry, data from your region currently has too low an accuracy rate to be used");
}
if(position == 2) {
stormCount = (.000000293212037634147 * Math.pow(xval, 6)) - (.0000642428907817738 * Math.pow(xval, 5)) + (.00526808502644371 * Math.pow(xval, 4))
- (.195157071357244 * Math.pow(xval, 3)) + (3.27415865786315 * Math.pow(xval, 2)) - (20.6557307408656 * xval) + 35.8205191551242;
storage = ("The amount of storms in "+states[position]+" in "+yearChoice+" is "+Math.floor(stormCount)+". This reading is about 70% accurate.");
}
---- ПУТЬ БОЛЬШЕ, ЕСЛИ ЗАЯВЛЕНИЯ ДЛЯ КАЖДОГО ЭЛЕМЕНТА В АРХИВЕ ----
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
}
public void submitButtonClicked(View v) {
networkResults.setText(storage);
}