how to fix Unresolved reference: packageManager in DialogFragment

getpackagemanager
android packagemanager
queryintentactivities
querybroadcastreceivers
getapplicationinfo android
setapplicationenabledsetting
getpackagearchiveinfo
hassystemfeature

I'm trying to make a call from DialogFragment but the (packageManager) doesn't accept how to solve it?!

class ItemDetkFragment : DialogFragment() {

override fun onCreateView(
    inflater: LayoutInflater, container: ViewGroup?,
    savedInstanceState: Bundle?
): View? {
    // Inflate the layout for this fragment
    val v: View= inflater.inflate(R.layout.fragment_item_detk, container, false)

    v.car_typee.text= car_item.type
    v.item_typee.text= car_item.item_type
    v.modele.text= car_item.modele
    v.pricee.text= car_item.price+ " JD"

    if (car_item.number> 0) {
        v.numberr.text= "available"
        v.numberr.setTextColor(Color.GREEN)

    } else {
        v.numberr.text= "Not available"
        v.numberr.setTextColor(Color.RED)

    }

    Picasso.with(activity).load(car_item.picUrl).into(v.photo)

    v.contactPhone.setOnClickListener {

        val phoneNum = "855394839583"// the number for testing
        val i = Intent(Intent.ACTION_DIAL)
        i.data = Uri.parse("tel:$phoneNum")

        if (i.resolveActivity(packageManager) != null) { //the 
       problem is here in (((((packageManager)))))it is in red!!!
            startActivity(i)
        }

    }

    return v
}


}

as you can see from the picture the (packageManager) is in red, how to fix it!!

Try this:

PackageManager packageManager = getActivity().getPackageManager();
if (i.resolveActivity(packageManager) != null) {
    startActivity(i)
}

PackageManager, Reference. Contents; Lifecycle DialogFragment does various things to keep the fragment's lifecycle driving it, instead of the Dialog. Note that dialogs are� Input to NuGet restore is a set of Package References from the project file (top-level or direct dependencies) and the output is a full closure of all the package dependencies including transitive dependencies. NuGet tries to always produce the same full closure of package dependencies if the input PackageReference list has not changed.

In your code packageManager isn't defined as a variable, instead change it to getPackageManager()

So it becomes

if (i.resolveActivity(getPackageManager()) != null) { 
        startActivity(i)
}

DialogFragment, Did you import R? The IDE can help import it. Just invoke one of the quick fix intentions, then import the R from your project. SOLVED: Cannot resolve symbol AppCompatActivity on Android Studio. If you have an old project version of Android Studio or from GitHub then watch this video

I noticed Android Studio only seems to have this problem when using Fragments. Consider using a MainPage instead. All the same, I hope this helps.

R is unresolved - Android, AtomicReference<V>, An object reference that may be updated atomically. AttachCallback, Base class for Aware attach callbacks. AttestedKeyPair DialogFragment, This class was deprecated in API level 28. Applications can implement this UI themselves using RecyclerView and PackageManager. A Map component in an app. This fragment is the simplest way to place a map in an application. It's a wrapper around a view of a map to automatically handle the necessary life cycle needs.

Class Index | Android 开发者, Get code examples like "how to undo migration in package manager console in could be found (are you missing a using directive or an assembly reference?) via DependencyResolution � android dialogfragment fullscreen stack overflow To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup � The fix for this is to open Package Manager Console and run this command: Update-Package -reinstall Note: If you just run Update-Package, it will try to update all packages to the latest version, which isn’t necessarily what you want (especially if you’ve simply pulled from source control and want the project to just build with the versions

how to undo migration in package manager console in asp.net mvc , Though DialogFragment triggered, but no layout is seen. Just visible the overlap blur background. Can't figure out the actual problem. Here is the code I use […]. Broken references after package restore: If you've opened a project and restored NuGet packages, but still see broken references, try reinstalling each of those packages. Project is broken due to deleted files : NuGet does not prevent you from removing items added from packages, so it's easy to inadvertently modify contents installed from a

container: ViewGroup? – Onooks, DialogFragment: can't find referenced method 'android.support.v4.app. PackageManager getPackageManager()' in class org.holoeverywhere.app. ResolverActivity [2013-05-19 00:13:53 - ] Warning: there were 51 unresolved references to program class members. IOException: Please correct the above warnings first.