OpenSeizureDetector / Android_Pebble_SD

The main OpenSeizureDetector Android App, that is published on the Android Play Store.
http://openseizuredetector.org.uk
GNU General Public License v3.0
9 stars 11 forks source link

since SDK_INT 14 R.id.____ cannot be used in switch-case. Replaced by if else if #82

Open AroonPro opened 1 year ago

AroonPro commented 1 year ago

Will be changed in AroonPro/Android_Pebble_SD/4.1.2_Upstream/MainActivity @Override public boolean onOptionsItemSelected(MenuItem item)

info: http://tools.android.com/tips/non-constant-fields

jones139 commented 1 year ago

I think this is only a problem if you are writing a 'library project' - one which is intended to be linked with other code, so there is the risk that R.id.xxx might be assigned a value used in another part of the project. I think it is ok in our case where Android_Pebble_SD is a stand-alone application rather than a library?

It won't do any harm to convert the switch statements to if...else, but I don't think we have to do it?

AroonPro commented 1 year ago

I've seen that Android Studio it underlined red. My assumption it would block compilation later on.

jones139 commented 1 year ago

It will be warning about the issue if you use it in a library, but I have no issue with you moving to if..else if you want to - I just don't think we have to :).

On Sun, 4 Jun 2023 at 19:56, AroonPro @.***> wrote:

I've seen that Android Studio it underlined red. My assumption it would block compilation later on.

— Reply to this email directly, view it on GitHub https://github.com/OpenSeizureDetector/Android_Pebble_SD/issues/82#issuecomment-1575673918, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACLSY2B7RB3KZ7AY4DGAILXJTK5ZANCNFSM6AAAAAAY2DA2HE . You are receiving this because you commented.Message ID: @.***>

-- Graham Jones http://google.com/+GrahamJones Hartlepool, UK.