When I try to build my Android project in IntelliJ i get error´s on every switch statement which cases use Id´s out of the R.java.
Example:
switch (item.getItemId()) {
case android.R.id.home:
NavUtils.navigateUpTo(this, DashboardActivity.upIntent(this));
return true;
case R.id.orders_options_add:
handleAddItem();
return true;
case R.id.orders_options_reorder:
handleReorder();
finish();
return true;
}
Does anyone know how to solve this problem?
Resource ids are not constants in a library project since ADT version 14, so you can't use them in switch statement. Just use if () {} else if () {} ...
instead.
You can find more detailed information here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With