1
Consider the following layout of a Activity:
<LinearLayout>
<android.support.v7.widget.AppCompatButton
android:id="@+id/btnLogin"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="clickNoBotao"
android:text="Login"/>
</LinearLayout>
Amending I:
Button mBotao = (Button) findViewById(R.id.btnCreateAccess);
mBotao.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//Código aqui
}
});
Amendment II:
public void clickNoBotao () {
//Código aqui
}
Amendment III:
public void clickNoBotao (View view) {
//Código aqui
}
Amendment IV:
Button mBotao = (Button) findViewById(R.id.btnCreateAccess);
mBotao.setOnClick(new View.OnClick() {
@Override
public void onClick(View view) {
//Código aqui
}
});
I wonder if these alternatives and the event code are in accordance with the code Linearlayout
From now on I thank you for the answer , and I am now learning this area of android , because I am php programmer and c#, thanks, and I will study this theme,.
– Jeovane