What is (View view) on Android?

Asked

Viewed 28 times

0

I usually find this in some parameter of an Activity.

For example:

public void onClick(View view){
    //código
}

I would like to know better what you are referring to.

  • That object view, is the object over the click action. This method is invoked when we define the attribute onClick in XML android:onClick="onClick", for example.

  • 1

    The first View, in capital letters, is the identifier of the argument type. The second view, lowercase, is the name of the argument. The name is arbitrary, so it could be done public void onClick(View minhaTelinha), now we have a name argument minhaTelinha who’s kind View, method signature equivalent to public void onClick(View view)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.