Answer the question
In order to leave comments, you need to log in
How to fix error when changing API level in Android Studio?
I decided to take on Android Studio for the first time and develop in this regard, respectively, a beginner.
I found an old ready-made project and edited it for myself, honing my skills, but...
When I change the API level from 28 to 30, I get an error:
project\app\src\main\java\com\name\appname\download .kt: (174, 39): Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type ClipData?
This field contains the following code:
view.ivLink.setOnClickListener(fun(view: View) {
val clipBoardManager =
context!!.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val primaryClipData = clipBoardManager.primaryClip
(174) val clip = primaryClipData.getItemAt(0).text.toString()
etURL.text = Editable.Factory.getInstance().newEditable(clip)
DownloadVideo(clip);
})
Answer the question
In order to leave comments, you need to log in
Here is the solution:
Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type ClipData
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question