Reputation: 612
I recently upgraded Android Studio to Arctic Fox | 2020.3.1 Patch 2. Whenever I use this code, it is highlighted as error (red underlines).
cursor.getColumncursor.getString(cursor.getColumnIndex(DataContract.WeightEntry.COLUMN_SYNC_STATUS));
Screenshot of highlighted code:
This is found in all the places where the getColumnIndex() function is used.
However, even if code is highlighted as an error, the compiler shows build success and the code runs fine.
Problem: Due to red underlines, it is causing a bad coding experience. I would like to know if this is a bug or something is wrong with my Android Studio settings. I have tried steps like:
Upvotes: 0
Views: 544
Reputation: 71
Just replace
cursor.getColumncursor.getString(cursor.getColumnIndex(DataContract.WeightEntry.COLUMN_SYNC_STATUS));
as
cursor.getColumncursor.getString(cursor.getColumnIndexOrThrow(DataContract.WeightEntry.COLUMN_SYNC_STATUS));
Upvotes: 0
Reputation: 56948
This is a known issue, right click and from the context actions select Suppress which will add @SuppressLint("Range")
(easiest fix/get-around).
I find it not feasible in my scenario to add those supresslint annotations when you have around 10-50 columns in a single table.That annotation will repeat a lot many times.
The @Suppress("Range")
can be placed at various levels of scope you can also use Analyze/Inspect Code and edit the profile e.g.
To then find the respective code filter on the warning e.g. Range in this case :-
Refer to https://developer.android.com/studio/write/lint
Upvotes: 2