Unresolved reference. None of the following candidates is applicable because of receiver type mismatch
I'm using androidx navigation architecture
along with Kotlin 1.2.71
in Android studio 3.2.1. My fragment code is:
package com.dell.andnav.fragments
import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.navigation.fragment.findNavController
import com.dell.andnav.R
import kotlinx.android.synthetic.main.fragment_welcome.*
/**
* A simple [Fragment] subclass.
* Use the [WelcomeFragment.newInstance] factory method to
* create an instance of this fragment.
*
*/
class WelcomeFragment : Fragment()
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View?
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_welcome, container, false)
override fun onViewCreated(view: View, savedInstanceState: Bundle?)
super.onViewCreated(view, savedInstanceState)
detailButton.setOnClickListener
findNavController().navigate(R.id.action_welcomeFragment_to_detailsFragment)
companion object
@JvmStatic
fun newInstance() = WelcomeFragment()
And layout code is:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.WelcomeFragment">
<Button
android:id="@+id/detailButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/to_detail_fragment"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
My build.gradle is:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'androidx.navigation.safeargs'
android
compileSdkVersion 28
defaultConfig
applicationId "com.dell.andnav"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
androidExtensions
experimental = true
buildTypes
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
dependencies
def nav_version = "1.0.0-alpha07"
implementation fileTree(dir: 'libs', include: ['*.jar'])
// implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
// implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation "android.arch.navigation:navigation-fragment-ktx:$nav_version"
implementation "android.arch.navigation:navigation-ui-ktx:$nav_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
repositories
mavenCentral()
When I try to run my code, I get below error:
Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public val Activity.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
public val Dialog.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
public val android.app.Fragment.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
public val androidx.fragment.app.Fragment.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
public val LayoutContainer.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
How can I resolve that error?
android kotlin androidx
add a comment |
I'm using androidx navigation architecture
along with Kotlin 1.2.71
in Android studio 3.2.1. My fragment code is:
package com.dell.andnav.fragments
import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.navigation.fragment.findNavController
import com.dell.andnav.R
import kotlinx.android.synthetic.main.fragment_welcome.*
/**
* A simple [Fragment] subclass.
* Use the [WelcomeFragment.newInstance] factory method to
* create an instance of this fragment.
*
*/
class WelcomeFragment : Fragment()
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View?
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_welcome, container, false)
override fun onViewCreated(view: View, savedInstanceState: Bundle?)
super.onViewCreated(view, savedInstanceState)
detailButton.setOnClickListener
findNavController().navigate(R.id.action_welcomeFragment_to_detailsFragment)
companion object
@JvmStatic
fun newInstance() = WelcomeFragment()
And layout code is:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.WelcomeFragment">
<Button
android:id="@+id/detailButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/to_detail_fragment"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
My build.gradle is:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'androidx.navigation.safeargs'
android
compileSdkVersion 28
defaultConfig
applicationId "com.dell.andnav"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
androidExtensions
experimental = true
buildTypes
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
dependencies
def nav_version = "1.0.0-alpha07"
implementation fileTree(dir: 'libs', include: ['*.jar'])
// implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
// implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation "android.arch.navigation:navigation-fragment-ktx:$nav_version"
implementation "android.arch.navigation:navigation-ui-ktx:$nav_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
repositories
mavenCentral()
When I try to run my code, I get below error:
Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public val Activity.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
public val Dialog.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
public val android.app.Fragment.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
public val androidx.fragment.app.Fragment.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
public val LayoutContainer.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
How can I resolve that error?
android kotlin androidx
why are you mixing support libraries with androidx libraries you should be using either.
– Karan Mer
Nov 16 '18 at 7:04
I modifiedbuild.gradle
, please check updated question. Getting same error now
– Ajay Kulkarni
Nov 16 '18 at 7:13
1
you should be accessing your view from your fragmentview.detailButton
as it is inside your fragement.
– Karan Mer
Nov 16 '18 at 7:20
add a comment |
I'm using androidx navigation architecture
along with Kotlin 1.2.71
in Android studio 3.2.1. My fragment code is:
package com.dell.andnav.fragments
import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.navigation.fragment.findNavController
import com.dell.andnav.R
import kotlinx.android.synthetic.main.fragment_welcome.*
/**
* A simple [Fragment] subclass.
* Use the [WelcomeFragment.newInstance] factory method to
* create an instance of this fragment.
*
*/
class WelcomeFragment : Fragment()
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View?
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_welcome, container, false)
override fun onViewCreated(view: View, savedInstanceState: Bundle?)
super.onViewCreated(view, savedInstanceState)
detailButton.setOnClickListener
findNavController().navigate(R.id.action_welcomeFragment_to_detailsFragment)
companion object
@JvmStatic
fun newInstance() = WelcomeFragment()
And layout code is:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.WelcomeFragment">
<Button
android:id="@+id/detailButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/to_detail_fragment"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
My build.gradle is:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'androidx.navigation.safeargs'
android
compileSdkVersion 28
defaultConfig
applicationId "com.dell.andnav"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
androidExtensions
experimental = true
buildTypes
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
dependencies
def nav_version = "1.0.0-alpha07"
implementation fileTree(dir: 'libs', include: ['*.jar'])
// implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
// implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation "android.arch.navigation:navigation-fragment-ktx:$nav_version"
implementation "android.arch.navigation:navigation-ui-ktx:$nav_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
repositories
mavenCentral()
When I try to run my code, I get below error:
Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public val Activity.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
public val Dialog.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
public val android.app.Fragment.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
public val androidx.fragment.app.Fragment.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
public val LayoutContainer.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
How can I resolve that error?
android kotlin androidx
I'm using androidx navigation architecture
along with Kotlin 1.2.71
in Android studio 3.2.1. My fragment code is:
package com.dell.andnav.fragments
import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.navigation.fragment.findNavController
import com.dell.andnav.R
import kotlinx.android.synthetic.main.fragment_welcome.*
/**
* A simple [Fragment] subclass.
* Use the [WelcomeFragment.newInstance] factory method to
* create an instance of this fragment.
*
*/
class WelcomeFragment : Fragment()
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View?
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_welcome, container, false)
override fun onViewCreated(view: View, savedInstanceState: Bundle?)
super.onViewCreated(view, savedInstanceState)
detailButton.setOnClickListener
findNavController().navigate(R.id.action_welcomeFragment_to_detailsFragment)
companion object
@JvmStatic
fun newInstance() = WelcomeFragment()
And layout code is:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.WelcomeFragment">
<Button
android:id="@+id/detailButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/to_detail_fragment"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
My build.gradle is:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'androidx.navigation.safeargs'
android
compileSdkVersion 28
defaultConfig
applicationId "com.dell.andnav"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
androidExtensions
experimental = true
buildTypes
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
dependencies
def nav_version = "1.0.0-alpha07"
implementation fileTree(dir: 'libs', include: ['*.jar'])
// implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
// implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation "android.arch.navigation:navigation-fragment-ktx:$nav_version"
implementation "android.arch.navigation:navigation-ui-ktx:$nav_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
repositories
mavenCentral()
When I try to run my code, I get below error:
Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public val Activity.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
public val Dialog.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
public val android.app.Fragment.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
public val androidx.fragment.app.Fragment.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
public val LayoutContainer.detailButton: Button! defined in kotlinx.android.synthetic.main.fragment_welcome
How can I resolve that error?
android kotlin androidx
android kotlin androidx
edited Nov 16 '18 at 7:13
Ajay Kulkarni
asked Nov 16 '18 at 6:53
Ajay KulkarniAjay Kulkarni
88852252
88852252
why are you mixing support libraries with androidx libraries you should be using either.
– Karan Mer
Nov 16 '18 at 7:04
I modifiedbuild.gradle
, please check updated question. Getting same error now
– Ajay Kulkarni
Nov 16 '18 at 7:13
1
you should be accessing your view from your fragmentview.detailButton
as it is inside your fragement.
– Karan Mer
Nov 16 '18 at 7:20
add a comment |
why are you mixing support libraries with androidx libraries you should be using either.
– Karan Mer
Nov 16 '18 at 7:04
I modifiedbuild.gradle
, please check updated question. Getting same error now
– Ajay Kulkarni
Nov 16 '18 at 7:13
1
you should be accessing your view from your fragmentview.detailButton
as it is inside your fragement.
– Karan Mer
Nov 16 '18 at 7:20
why are you mixing support libraries with androidx libraries you should be using either.
– Karan Mer
Nov 16 '18 at 7:04
why are you mixing support libraries with androidx libraries you should be using either.
– Karan Mer
Nov 16 '18 at 7:04
I modified
build.gradle
, please check updated question. Getting same error now– Ajay Kulkarni
Nov 16 '18 at 7:13
I modified
build.gradle
, please check updated question. Getting same error now– Ajay Kulkarni
Nov 16 '18 at 7:13
1
1
you should be accessing your view from your fragment
view.detailButton
as it is inside your fragement.– Karan Mer
Nov 16 '18 at 7:20
you should be accessing your view from your fragment
view.detailButton
as it is inside your fragement.– Karan Mer
Nov 16 '18 at 7:20
add a comment |
2 Answers
2
active
oldest
votes
Button you are accessing is inside your fragement but your are accessing it directly. You should access it via parent view like we do with java rootview.findViewById()
so use
view.detailButton.setOnClickListener
findNavController().navigate(R.id.action_welcomeFragment_to_detailsFragment)
add a comment |
In my case this function led to the error:
private fun showProgress(view: View? = null)
(view?.progressBar ?: progressBar)?.visibility = View.VISIBLE
Android Studio offered layouts that contained progressBar
, and I chose one. But view?.progressBar
continued to be red. Then I shortened a header:
private fun showProgress(view: View)
.
Only after that AS offered layouts. Then I again wrote: private fun showProgress(view: View? = null)
.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53332832%2funresolved-reference-none-of-the-following-candidates-is-applicable-because-of%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Button you are accessing is inside your fragement but your are accessing it directly. You should access it via parent view like we do with java rootview.findViewById()
so use
view.detailButton.setOnClickListener
findNavController().navigate(R.id.action_welcomeFragment_to_detailsFragment)
add a comment |
Button you are accessing is inside your fragement but your are accessing it directly. You should access it via parent view like we do with java rootview.findViewById()
so use
view.detailButton.setOnClickListener
findNavController().navigate(R.id.action_welcomeFragment_to_detailsFragment)
add a comment |
Button you are accessing is inside your fragement but your are accessing it directly. You should access it via parent view like we do with java rootview.findViewById()
so use
view.detailButton.setOnClickListener
findNavController().navigate(R.id.action_welcomeFragment_to_detailsFragment)
Button you are accessing is inside your fragement but your are accessing it directly. You should access it via parent view like we do with java rootview.findViewById()
so use
view.detailButton.setOnClickListener
findNavController().navigate(R.id.action_welcomeFragment_to_detailsFragment)
answered Nov 16 '18 at 7:27
Karan MerKaran Mer
5,61132966
5,61132966
add a comment |
add a comment |
In my case this function led to the error:
private fun showProgress(view: View? = null)
(view?.progressBar ?: progressBar)?.visibility = View.VISIBLE
Android Studio offered layouts that contained progressBar
, and I chose one. But view?.progressBar
continued to be red. Then I shortened a header:
private fun showProgress(view: View)
.
Only after that AS offered layouts. Then I again wrote: private fun showProgress(view: View? = null)
.
add a comment |
In my case this function led to the error:
private fun showProgress(view: View? = null)
(view?.progressBar ?: progressBar)?.visibility = View.VISIBLE
Android Studio offered layouts that contained progressBar
, and I chose one. But view?.progressBar
continued to be red. Then I shortened a header:
private fun showProgress(view: View)
.
Only after that AS offered layouts. Then I again wrote: private fun showProgress(view: View? = null)
.
add a comment |
In my case this function led to the error:
private fun showProgress(view: View? = null)
(view?.progressBar ?: progressBar)?.visibility = View.VISIBLE
Android Studio offered layouts that contained progressBar
, and I chose one. But view?.progressBar
continued to be red. Then I shortened a header:
private fun showProgress(view: View)
.
Only after that AS offered layouts. Then I again wrote: private fun showProgress(view: View? = null)
.
In my case this function led to the error:
private fun showProgress(view: View? = null)
(view?.progressBar ?: progressBar)?.visibility = View.VISIBLE
Android Studio offered layouts that contained progressBar
, and I chose one. But view?.progressBar
continued to be red. Then I shortened a header:
private fun showProgress(view: View)
.
Only after that AS offered layouts. Then I again wrote: private fun showProgress(view: View? = null)
.
answered Jan 28 at 15:38
CoolMindCoolMind
4,43114077
4,43114077
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53332832%2funresolved-reference-none-of-the-following-candidates-is-applicable-because-of%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
why are you mixing support libraries with androidx libraries you should be using either.
– Karan Mer
Nov 16 '18 at 7:04
I modified
build.gradle
, please check updated question. Getting same error now– Ajay Kulkarni
Nov 16 '18 at 7:13
1
you should be accessing your view from your fragment
view.detailButton
as it is inside your fragement.– Karan Mer
Nov 16 '18 at 7:20