Can’t find getPackageManager() method in android

The error is not in your line of code, but where you are calling it. getPackageManager() is a method of Context. You can use this method inside an Activity (because an Activity is a Context), but if you are calling it elsewhere, you need to pass a Context. In a fragment you may also have access to the getActivity() function, which returns the Acitivity-Context.

    Context context...;

    context.getPackageManager();
    getActivity().getPackageManager();

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)