androidonclicklistenerandroid-viewandroid-viewgroup

what are view and View in "import android.view.View"


I want to know the difference between view and View in "import android.view.View"statement.My confusion is whether View is a package or a class. If View is a class, what is View.OnClickListener


Solution

  • view is a robust package that contains a lot of classes, interfaces, annotations, enums and exceptions. The view package typically handles all forms of screen layouts as well as their interactions with the user.

    The View class is one of the many classes contained in the view package. It is basically the building block of every user interface component (Buttons, ImageViews, LinearLayouts, etc).

    If View is a class, what is View.OnClickListener

    View.OnClickListener is an interface of the View class. All it does is to invoke a callback when the view is clicked.

    I hope this helps.. Merry coding!